[Pymilter] poll() returned exception for socket, abort
Tom Hendrikx
tom at whyscream.net
Sun Jan 13 16:48:39 EST 2013
On 13-01-13 21:10, Stuart D Gathman wrote:
> On Jan 13, Tom Hendrikx transmitted in part:
>
>>> I'm currently adding daemon support to my milter, using a simplified
>>> version of the routine as documented in PEP3143 and implemented in
>>> http://pypi.python.org/pypi/python-daemon/
>>>
>>> For some reason, the milter aborts after processing the single
>>> connection. The first connection is handled properly, and a few seconds
>
> Can you post your main code?
Code is at github. Main startup routine:
https://github.com/whyscream/pydspam/blob/master/dspam/milter.py#L258
And the daemon routine:
https://github.com/whyscream/pydspam/blob/master/dspam/utils.py#L17
> Things I can think of:
>
> o libmilter insists on handling signals, you probably don't want
> daemon to do so. Making sure you daemonize *before* making any
> milter calls (like register, main) would probably work. I would
> disable all signal stuff in daemon.
>
> o The milter setup (register, main) would again need to be after
> daemon. Closing the socket to sendmail that libmilter opened would
> be bad.
I had a signal handler enabled for SIGTERM, removing it now (although I
don't think that was the culprit). All daemon related stuff is done
before calling Milter.runmilter()
>
> o I can't think how you would manage it, other than call daemon from a
> callback, but it should not be called for every connection.
>
> o Maybe daemon is changing a signal that libmilter depends on?
The code at github seems to work fine now, after I found out that the
process keeps running when I only close stdin/stdout/stderr, and leave
other fds alone. That's not what I wanted to do, but it seems to help
somehow.
--
Tom
More information about the Pymilter
mailing list