http://bugzilla.spamassassin.org/show_bug.cgi?id=4370
Summary: Failed exec in forked helper process continues its
miserable life
Product: Spamassassin
Version: SVN Trunk (Latest Devel Version)
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P3
Component: Libraries
AssignedTo: [email protected]
ReportedBy: [EMAIL PROTECTED]
The Util.pm module does:
exec @cmdline; die "util: exec failed: $!";
in a forked process ready to become an external application.
The problem occurs if exec fails (e.g. pyzor is too strongly
protected). In that case the die is supposed to terminate
the spawned process, yet it seems to be intercepted by some
higher-level eval, which leads to a horror situation where
both the parent and its forked copy try to continue processing
the same mail and to communicate with its environment, stepping
on each other's toes.
In case of amavisd-new this shows as unexplainable secondary
error reports, failed writes to a MTA socket or Berkeley db locker
problems. I can imagine the situation is bad in spamd setup as well,
although I don't know how it manifests itself.
Even if eval were avoided and let 'die' do its job, this is still
not good enough, as the Perl END and destructor processing by a
spawned process may attempt to cleanup what is still needed
by a parent process - and in fact this was demonstrated to
still cause trouble in amavisd-new, and likely in spamd as well.
The solution that is known to work properly is:
exec ...
# log error in $!
POSIX::_exit(1); # avoid END and destructor processing
kill('KILL',$$); # still kicking? die!
(the POSIX::_exit is suggested by the perlfunc man page
at the exit() entry)
Mark
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.