Red Hat Bugzilla – Bug 137709
"sigwait returned error: 0" errors from milter
Last modified: 2007-11-30 17:10:53 EST
I just upgraded from kernel 2.4.27-pre2-pac1 to Red Hat kernel
2.6.9-1.643smp and from glibc-2.3.3-63 to glibc-2.3.3-74. I also
upgraded perl and sendmail to the current development versions. I
also recompiled Sendmail::Milter against the current version of perl
and sendmail. I have a milter written in Perl that uses
Sendmail::Milter and calls an external process by forking and execing.
It is now logging this over and over again when I start it and then
crashing shortly after startup:
Oct 31 00:44:12 jik perl: bogofilter-milter: sigwait returned error: 0
It does seem to process some number of messages before it crashes. I
don't know if the log message above is related to he fact that it
keeps crashing. In any case, it would seem that I can't use this
milter until I can figure out how to resolve this issue.
Thanks for any help you can provide.
I love it when I file a bug and it hasn't been touched seven months later.
I finally got myself a new PC and upgraded to kernel 2.6 for real and
permanently, and I was still encountering this problem, so I spent the time to
debug it myself.
The problem is that the sigwait function on Linux doesn't behave as documented.
The man page claims, "The sigwait function never returns an error," but in fact
it can return several errors, the relevant one in this case being EINTR. The
other problem is that when it returns an error, for some reason errno is still
0. The first problem is a documentation error, the second one is probably a
glibc error. I will file separate bugs about those. In the meantime, I have
attached a patch to make libmilter function properly.
Created attachment 114948 [details]
Cope with linux sigwait ABI
The comment I put in my patch is probably not quite right. It should probably
say, "sigwait returns an error code on some Linux versions and doesn't preserve
Jakub makes an interesting point in bug 159085. He says that the spec says
sigwait isn't supposed to touch errno, that it's supposed to return an error
code rather than putting it in errno. That means that the code in libmilter
which is checking errno after sigwait returns a non-zero status is completely
buggy, not just bubby on Linux -- it should always be using the return value as
the error code rather than checking errno.
This has been fixed in upstream sendmail.
Closing as fixed in "RAWHIDE".