I agree with Gilles, your filter should react on stdin closing, but not sure how your filter is set up.

Also, just a guess... are you running smtpd on Linux?

Linux doesn't kill children when the parent process dies, maybe that's
related? (To make it do that prctl(2) would need to be used w/
PR_SET_PDEATHSIG.)


On Tue, Apr 02, 2024 at 06:53:39AM +0000, gil...@poolp.org wrote:
April 2, 2024 4:47 AM, and...@tekrealm.net wrote:

What signals a termination for smtpd filters?

I'm using the code at https://github.com/Beutlin/howto-opensmtpd-filters-and-reports, Which works great, except for when smtpd gets shutdown. The script continues to run and consumes up to 100% cpu time, while keeping the smtpd parent? process running.

I've tried adding a SIGTERM handler to the code which didn't work, as well as I saw mentioned that the filter should exit on EOF, so I tried wrapping parser.dispatch() in
a try/except EOFError and using sys.exit. That didn't work either.

I've read smtpd-filters, and looked at various other filters and I am not understanding
what tells the filter to shutdown.


The filter is connected to smtpd through its stdin, so it can terminate when there's an EOF on stdin.

This is the proper way to do it and how all filters I wrote work but maybe a bug has crawled in the handling of filter termination and it went unnoticed, I donĀ“t think I ever terminated smtpd in years besides system restarts.

What system are you running on ?


Reply via email to