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
eventlet is incompatible with dnspython 2.0.0rc1 #619
Comments
this might be a problem in the all list in RC1 as I see it lists asyncquery.py in there. I will fix in dnspython. |
@frenzymadness @rthalley thank you for the heads up. I can't look into this right now (maybe someone else will) but thank you nonetheless! |
For what it is worth dnspython 2.0.0 release dropped yesterday in pypi and this was a breaking change for us. Our container could no longer resolve rabbitmq host. We are using nameko 2.12.0 with eventlet 0.25.2. If we pinned dnspython to 1.16.0 our issues were fixed. Apologies for the screenshot but it is hard to get full stack trace from our log collector. |
The problem here is that the APIs to dns.query.udp() and dns.query.tcp() changed in dnspython 2.0.0, and eventlet is monkey patching them with the old versions. In particular, dns.query.udp() got a new raise_on_truncation parameter which the resolver is trying to use, and this is causing a TypeError "udp() got an unexpected keyword argument 'raise_on_truncation'" exception any time the resolver tries to call udp(). The resolver treats such exceptions as a "try again" type error, and hence the resolution ultimately times out. Eventlet will need to detect which version of dnspython is running (import dns.version) and monkey patch appropriately. Note that the raise_on_truncation is not the only change, as the af parameter is now gone, and you can also pass sockets to both udp() and tcp(). /Bob |
OpenStack Nova also found the same eventlet - dnspython 2.0.0 incompatibility tracked in https://bugs.launchpad.net/nova/+bug/1888237 |
* Update requirements from branch 'master' - Merge "Pin dnspython to 1.16.0 as eventlet fails with 2.0.0" - Pin dnspython to 1.16.0 as eventlet fails with 2.0.0 As per issue eventlet/eventlet#619 eventlet is not compatible with dnspython 2.0.0 making nova novnc proxy to fail if TLS is configured. Closes-Bug: #1888237 Change-Id: Ic2a38b77b5c217f769f67ed1c45d3aeb90d9cbff
As per issue eventlet/eventlet#619 eventlet is not compatible with dnspython 2.0.0 making nova novnc proxy to fail if TLS is configured. Closes-Bug: #1888237 Change-Id: Ic2a38b77b5c217f769f67ed1c45d3aeb90d9cbff
@ralonsoh hi, I'm surprised, how did you push a branchless commit to this repo, I don't see you in commiters list. No offense here, pure curiosity. And thanks for fix. |
Everybody affected by this problem with a free minute is warmly invited to test Rodolfo solution. (this is his commit rebased on master 0.26) |
I don't think this will fix the underlying issues, because the dnspython resolver is still used, and it calls dns.udp.query() with a parameter, raise_on_truncation, that the monkey patched replacements don't understand. (see my description above) |
issue #632 which we closed as a duplicaite of this issue fails with dnspython 2.0.0 it was failing because TypeError: _wrap_socket() argument 1 must be _socket.socket, not GreenSSLSocket it was not clear what the conenct between the dnspython package and ssl was to me looking at the trace back but downgradign dnspython resolved the issue. perhaps we shoudl reopen #632 to track it seperatly otherwise i think commit 46fc185 is not a compete fix. we certenly could not uncap dnspython in openstack just by addressing the issue that neutron hit which @ralonsoh is fixing. nova would still fail when using websockify with tls for our vm console proxy server. |
v0.26.1 just uploaded to PyPI with temporary workaround by @eacmen pin |
62: Update eventlet to 0.26.1 r=duckinator a=pyup-bot This PR updates [eventlet](https://pypi.org/project/eventlet) from **0.26.0** to **0.26.1**. <details> <summary>Changelog</summary> ### 0.26.1 ``` ====== * pin dnspython <2.0.0 eventlet/eventlet#619 ``` </details> <details> <summary>Links</summary> - PyPI: https://pypi.org/project/eventlet - Changelog: https://pyup.io/changelogs/eventlet/ - Homepage: http://eventlet.net </details> Co-authored-by: pyup-bot <github-bot@pyup.io>
… 0.26.1 Gorka Eguileor (2): Fix #508: Py37 Deadlock ThreadPoolExecutor (#598) Remove unnecessary assignment in _recv_loop (#601) James Page (2): Fix misc SyntaxWarning's under Python 3.8 Fix compatibility with SSLContext usage >= Python 3.7 Michał Górny (4): tests: F_SETFL does not return flags, use F_GETFL again tests: Unset O_NONBLOCK|O_NDELAY to fix SPARC tests: Assume that nonblocking mode might set O_NDELAY to fix SPARC tests: Increase timeout for test_isolate_from_socket_default_timeout Peter Eacmen (1): pin dnspython <2.0.0 Sergey Shepelev (3): drop Python 3.4 support v0.26.0 release v0.26.1 release Tim Burke (2): tests: Fail on timeout when expect_pass=True (#612) wsgi: Fix header capitalization on py3 0.26.1 ====== * pin dnspython <2.0.0 eventlet/eventlet#619 0.26.0 ====== * Fix compatibility with SSLContext usage >= Python 3.7 * wsgi: Fix header capitalization on py3 * Fix #508: Py37 Deadlock ThreadPoolExecutor (#598) * drop Python 3.4 support * Fix misc SyntaxWarning's under Python 3.8 * Remove unnecessary assignment in _recv_loop (#601)
This workaround might help when eventlet is installed from PyPI but it doesn't help to distribution RPM/DEB packages. For example, we updated dnspython to the latest version in Fedora and now we are no longer able to build eventlet in RPM package. |
I agree. The ssl module still does not work with dnspython 2.0 even with the fix in #639: $ pip install --upgrade https://github.com/jayvdb/eventlet/archive/dnspython2.zip
$ pip install dnspython==2.0
$ PYMONGO_MUST_CONNECT=1 python green_framework_test.py eventlet -s test.test_client_context
...
File "/Users/shane/git/mongo-python-driver/pymongo/pool.py", line 1180, in connect
sock = _configured_socket(self.address, self.opts)
File "/Users/shane/git/mongo-python-driver/pymongo/pool.py", line 1002, in _configured_socket
sock = ssl_context.wrap_socket(sock, server_hostname=host)
File "/Users/shane/git/mongo-python-driver/venvPYTHON-1854/lib/python3.8/site-packages/eventlet/green/ssl.py", line 448, in wrap_socket
return GreenSSLSocket(sock, *a, _context=self, **kw)
File "/Users/shane/git/mongo-python-driver/venvPYTHON-1854/lib/python3.8/site-packages/eventlet/green/ssl.py", line 69, in __new__
ret = _original_sslsocket._create(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 1031, in _create
self._sslobj = self._context._wrap_socket(
TypeError: _wrap_socket() argument 'sock' must be _socket.socket, not SSLSocket
... |
FWIW, I looked at that SSL error a bit. It's hard to figure out not really understanding either the original python SSL code nor eventlet's wrapping, but it seems like a double wrapping. Not sure how that could happen or what dnspython could have to do with it, but maybe some change in error paths? At any rate, I repeat what I said above, which is that none of the fixes I've seen so far address the raise_on_truncation problem, so I expect that eventlet's patching of getaddrinfo, etc. will be getting timeouts after around 5 seconds. The test program I wrote along with an instrumented dnspython still shows this problem exists with the master branch of eventlet. I suggest fixing this problem might be a good first start, as we know it is wrong. |
If someone wants to test "does fixing the truncation problem help with the SSL problem", here is a hack for the truncation issue. This is NOT a fix, as it doesn't actually raise_on_truncation, which will break resolutions with truncation. This is merely a way to test relatedness to the SSL issue. I can't test with mongodb myself as I don't have it set up. This hack basically takes the #639 compute_expiration change, just for UDP, and then changes the function signature to be compatible with dnspython 2.0. (And thus INCOMPATIBLE with < 2.0.) With this hack, basic resolutions now work for me again instead of timing out.
|
Oh, and here is the test program for basic resolutions. Without the hack, both invocations fail due to triggering the
|
Wait so is the bug going to be fixed? I think it's great to see workarounds and limiting to <2.0 to stop breaking things, but what about the future? Sorry if I missed something |
Newer (2.0+) dnspython imports ssl (and requests, which would have eventually imported ssl), so greendns needs a monkey-patched ssl, too. This should prevent a RecursionError with SSLContext. Note that this *does not* bring full dnspython>=2.0 support, but our version pin hasn't stopped people from trying to run with newer dnspython anyway. May as well make it hurt a little less. Fixes eventlet#677, but see also eventlet#619.
Newer (2.0+) dnspython imports ssl (and requests, which would have eventually imported ssl), so greendns needs a monkey-patched ssl, too. This should prevent a RecursionError with SSLContext. Note that this *does not* bring full dnspython>=2.0 support, but our version pin hasn't stopped people from trying to run with newer dnspython anyway. May as well make it hurt a little less. Fixes #677, but see also #619.
Hi, I've tested this with eventlet version 0.3 and dnspython 1.16.0 and I'm still having the same error Is there a workaround for this at the moment? |
@Xronis 0.3? |
@temoto I was trying with v0.31.0 and then after trying this
I got v0.26.0 that still produces the error. Am I doing something wrong here? |
@Xronis you seem to be doing correct actions. Did you recreate virtualenv or somehow made sure that dnspython <2 is installed? Can you show |
Since I'm using Pycharm I used the integrated package manager to make sure that I got dnspython to 1.16.0. I'm using windows 10 and I'm not really sure if there is an
Let me know if I need to perform something extra. |
@Xronis so people say downgrading dnspython to |
Hmmm interesting. Thanks for trying @temoto. May I ask, if there is a plan for supporting of dnspython => 2.0? |
@Xronis yes as in "prioritized task", no as in "expect to be done by X date". |
That's understandable. Thank you for your response! |
As a heads-up, it looks like supporting newer dnspython will be a necessary prerequisite to supporting Python 3.10. |
Everyone subscribed to this issue is very welcome to test another fix at #722
|
Compatibility with dnspython v2: - `_compute_expiration` was replaced by `_compute_times` - `dns.query.{tcp,udp}` take new arguments Main issue for tracking: #619 This patch discussion: #722 This patch deprecates dnspython<2 pin: #629 Co-authored-by: John Vandenberg <jayvdb@gmail.com> Co-authored-by: Rodolfo Alonso Hernandez <ralonsoh@redhat.com>
Hopefully we're fully compatible with dnspython2 by now. Please reopen if there are problems still. |
Hello.
dnspython version 2.0.0 will be released soon (it's a release candidate now, rthalley/dnspython#466) and it seems that eventlet is not compatible with it.
Could you please take a look on that? Let me know if I can help anyhow.
The text was updated successfully, but these errors were encountered: