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