[Pymilter] milter multiprocess (or multithread)
Marco
falon at ruparpiemonte.it
Mon Dec 9 03:51:05 EST 2019
Hello Stuart,
thank you very much for your detailed answer.
This is all clear now. I'm enjoying with pymilter to write my milter
with multiprocess/multithread for Redis and submit some data through
http rest api.
In my milter I decide to leave the choice to use threads or processes
for above jobs by configuration.
All works fine as expected. But with *threads* only, it seems that the
milter eats the sigterm signal. To be fast, if I have this
milter-template.py:
====================================================================
if False:
from multiprocessing import Process as Thread, Queue
else:
from threading import Thread
from queue import Queue
[...]
logq.put(None)
bt.join()
print("%s bms milter shutdown" % time.strftime('%Y%b%d %H:%M:%S'))
if __name__ == "__main__":
main()
====================================================================
when I terminate the milter, the "bms milter shutdown" never prints to
stdout.
This is just a "cosmetic" issue, but it should nice to print a "milter
shutdown" when the milter stops as expected.
If I well understand this is a limitation from libmilter interface. I
don't understand how to avoid this limit really. For instance, could I
terminate the milter sending a "stop" command?
How could I read or write a "stop", or "reload" command to the milter
socket? Using the Milter api I can only manage body, headers, and other
standards milter commands.
Do you have any hints?
Thank you very much
Marco
On 12/11/2019 18:56, Stuart D. Gathman wrote:
> On Tue, 12 Nov 2019, Marco wrote:
>
[...]
> You already get a new thread for every connection out of the box. You
> almost certainly don't want to create a process for each connection.
>
More information about the Pymilter
mailing list