Forking after starting AsyncioSelectorReactor: Supported?

David Foster <[email protected]>
Newsgroups gmane.comp.python.twisted
Message-ID <[email protected]>
Hi Twisted list!

I have a library that is attempting to start an AsyncioSelectorReactor, 
fork the process, and then open a network socket on macOS. When the 
network socket is opened, Twisted throws an [Errno 9] "Bad file 
descriptor" exception at me. I get no such exception on Ubuntu.

If I change the sequence from:
     setup_reactor('AsyncioSelectorReactor')
     fork_and_continue_in_child()
     run_server()
to:
     fork_and_continue_in_child()             # fork first
     setup_reactor('AsyncioSelectorReactor')
     run_server()
Then everything works okay.

Also if I use SelectReactor rather than AsyncioSelectorReactor then it 
doesn't matter which order I fork in.

So my question is, does Twisted support being forked after starting a 
reactor or not?

-- 
David Foster | Seattle, WA, USA


P.S. For more details see this Django Channels thread: 
https://github.com/django/channels/issues/962#issuecomment-414103367

_______________________________________________
Twisted-Python mailing list
[email protected]
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.