-
Notifications
You must be signed in to change notification settings - Fork 421
Deadlock with pyOpenSSL 16.1.0, Deluge and SSL torrent trackers #551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@reaperhulk how do you imagine that PR looking, just moving the import into the relevant functions? I won't object to such a patch, however I'm a bit concerned that it's moving the peas around our plate and hoping our parents don't notice. Specifically, anyone who uses those functions (which might be limited ATM, tbh) will continue to hit issues, and they'll just be harder to debug. Also anyone who uses both pyOpenSSL and cryptography's backend APIs will as well. |
I was envisioning it as moving the backend import to a separate module and calling The disadvantage to this approach is obviously that it stops cryptography from using the superior osrandom engine, but based on the scant reports of problems before we activated it in pyOpenSSL I'm guessing we don't have a great deal of overlap in users of our hazmat/recipes and pyOpenSSL. Long term obviously we don't want to be deactivating osrandom, but we won't have the replacement ready immediately. |
As I've said before, I strongly object to calling On Wed, Oct 5, 2016 at 8:01 AM, Paul Kehrer [email protected]
"I disapprove of what you say, but I will defend to the death your right to |
Certainly moving the import into the function will fix it for most users (who are not calling those conversion routines). Maybe that's sufficient. Obviously the tradeoff is that if a user does call the offending functions at some point during their program execution, is in a multiprocess/multithread execution environment, and subsequently makes a TLS connection using pyOpenSSL they'll trigger the bug. I don't have a strong preference since every choice has drawbacks. I will force you to express an opinion tonight @hynek ;) |
There's one thing I'd love to get explained, why does libtorrent, a C++ library with Python bindings, end up calling libssl that calls back into Python ? The disconnect for me is in Thread 3 - # 9 # 10 # 11 |
There's only one instance of libssl loading into the process space and when pyOpenSSL loads up it is activating an engine that calls back into Python. So even invocations of TLS calls by libtorrent will trigger the callback. |
This should be resolved in 16.2.0 |
When using Deluge with pyOpenSSL 16.1.0 and torrents with trackers using https then Deluge will end up in a deadlock. It works fine with 16.0.0.
I've attached the stacktrace and I think the deadlock is between Thread 3 trying to acquire GIL lock and Thread 1 currently holding it. I'm unsure why this is happening as libtorrent-rasterbar is a C library.
You can reproduce this by installing pyOpenSSL 16.1.0, any recent version of Deluge, any recent version of libtorrent and any recent version of OpenSSL. Add a few torrents with https trackers (these trackers does not need to work, loading the SSL context seems sufficient). Restart Deluge until it locks up during boot.
After it locks up once it'll keep locking up.
The text was updated successfully, but these errors were encountered: