[Twisted-Python] Using twistd with -c option causes permission error
I'm trying to use the -c option of twistd like this : twistd web --wsgi bar.app -c foo.cer -k privkey.pem --https=4433 I'm pointing it at a cert with perms like this "-rw-r--r-- 1 root root" but twistd complains about a permission error . I'm puzzled ... surely twistd only needs to read that file ? Thanks . ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Re: [Twisted-Python] Using twistd with -c option causes permission error
On Tuesday, August 28, 2018 2:10:22 AM CEST Richard Shea wrote: > I'm trying to use the -c option of twistd like this : > > twistd web --wsgi bar.app -c foo.cer -k privkey.pem --https=4433 > > I'm pointing it at a cert with perms like this "-rw-r--r-- 1 root root" but > twistd complains about a permission error . > > I'm puzzled ... surely twistd only needs to read that file ? Is it complaining about the permissions on the cert or on the private key? Some applications (like SSH) reject private keys if they are world-readable, as a precaution. Bye, Maarten ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
[Twisted-Python] Forking after starting AsyncioSelectorReactor: Supported?
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 Twisted-Python@twistedmatrix.com https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Re: [Twisted-Python] Forking after starting AsyncioSelectorReactor: Supported?
On Mon, Aug 27, 2018 at 09:12:57PM -0700, David Foster wrote: > So my question is, does Twisted support being forked after starting a > reactor or not? I haven't used Twisted with the AsyncioSelectorReactor on macOS myself, but the `asyncio` docs suggest[1] that the default macOS event loop uses the `kqueue` system call. Searching for "macos fork kqueue" finds a report[2] of the same behaviour in the C++ Boost asyncio library. Apple doesn't seem to publish manpages publically anymore, but the `kqueue` system call was borrowed from FreeBSD which does[3]: # The kqueue() system call creates a new kernel event queue and returns a # descriptor. The queue is not inherited by a child created with fork(2). So, my guess is that `kqueue` just can't be used with `fork` in that way. If you really need to set up a reactor and then fork, perhaps you can configure `asyncio` to use the `selectors.SelectSelector` or `selectors.PollSelector` event loops instead; they're less efficient, but they should work after a fork. This behaviour doesn't occur on Ubuntu because Linux provides the `epoll` system call instead of `kqueue`, which behaves differently. [1]: https://docs.python.org/3.6/library/asyncio-eventloops.html#mac-os-x [2]: https://svn.boost.org/trac10/ticket/3238 [3]: https://www.freebsd.org/cgi/man.cgi?query=kqueue&manpath=FreeBSD+11.2-RELEASE+and+Ports ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python