[Twisted-Python] epoll keep sharing state between process even after fork.
grindizer at gmail.com
Wed Oct 23 09:46:24 MDT 2013
I a came across a surprising problem when using the epoll based reactor.
(ticket here https://twistedmatrix.com/trac/ticket/6796)
As you can see on the ticket, the epoll object seems to share some state
even after fork.
Which means even after having forked the process, making some changes to
the inherited epoll object in one process may impact the one existing in
another process !
This problem is only related to epoll based reactor, poll and select behave
I'm aware that some may say that this in not a twisted related problem (but
an epoll issue), but I'm addressing my question here to try to figure out
what would be the best workaround for this problem in a twisted based
And for information this is what I have already tryed:
- I though about using poll or select reactor, but this is not possible,
cause as i'm writing a library I do not decide which reactor will be
installed by the person who want to use it.
(Besides as epoll is now the default reactor installed, I certainly want my
library to work with it !)
- Using spawnProcess as mentioned in the ticket comment, is not an option
too, in my case, I need to share some state between the main process and
subprocess. (I have on object in main process space that I want to inherit
in all subprocess)
- I (desperately) tryed to re-initialize the reactor._poller object after
each fork to set it with a new object, but it was just a very bad idea ! :)
Thank you, in advance, for any possible clue !
(for information, my project is here https://github.com/Grindizer/scaletix)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Twisted-Python