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
greendns: Pre-1.10.0 dnspython support #341
Conversation
Following commit 861d684, eventlet cannot be installed alongside dnspython<1.10.0. This breaks on Ubuntu 12.04, for example, which ships 1.9.4 as a system package. There are two parts to the fix: Since version 1.10.0, dnspython's inet_aton functions would raise dns.exception.SyntaxError on invalid address strings. Prior to that, however, inet_aton was a thin wrapper around socket.inet_aton and would therefore raise socket.error on invalid addresses. So we'll catch either error when checking ipv4/6 addresses. Additionally, dnspython 1.10.0 introduced the LRUCache class. We should fall back to the interval-based Cache class if LRUCache is not available. Note that it is already being used in clear(). Prior to commit 861d684, either of these would have been caught as an ImportError in eventlet/green/socket.py and we would have just assumed dnspython wasn't available.
The patch makes sense. But I can't understand the goal. Can you explain how somebody would want to install latest eventlet in system packages of old freeze-release OS? I know two good ways:
|
Ah, but since eventlet doesn't have a dependency on dnspython, Suppose you had two packages you care about, A (which depends on dnspython) and B (which depends on eventlet). Years ago, you installed both of them, and life was good. As time passed, you upgraded B regularly (maybe you need some new features, or security fixes, or what-have-you) but never A (because it still did what you needed and given the costs/benefits of validating that newer versions still worked, it never made sense). Things are still fine! Currently. Until you try to upgrade B following the next eventlet release, at which point B drags forward eventlet, and eventlet fails to install with something akin to
... at which point you're thoroughly confused and have no idea that:
(Alternatively, you could be in my position, of stupidly using the system dnspython while also wanting to ship latest eventlet on 12.04. But that's my own idiocy, and I should probably just go package and ship latest dnspython as well 😛 -- I just figured I ought to put this out there to save other people headaches.) |
Thanks for sharing this issue. So we have a new kind of dependency: not required, but only compatible with some version. For those who google install eventlet socket.error illegal IP address string passed to inet_aton: first do I think solution is we should bundle dnspython. That also makes DNS requests always green. Such a good day. |
Fixes installation issue when older dnspython is present in system packages #341
Please review 0983889 |
Fixes installation issue when older dnspython is present in system packages #341
Fixes installation issue when older dnspython is present in system packages #341
Thanks for feedback, please, review new version 95a3159 |
Change makes sense, and I can successfully install bundle-dns eventlet alongside old dnspython. I noticed that |
Fixes installation issue when older dnspython is present in system packages #341
Well it should produce different output, right? Anyway, bundled dns is now merged in master 52b09be |
Thinking about it more, |
Thanks! FWIW, it looks like requests handles a similar situation with urllib3 by using relative imports for their vendored version. I.e., working with |
Yeah, at first I tried to go with relative imports, started writing a patch change imports in dnspython, imagined how much work it would be to update the patch to next version of |
Following commit 861d684, eventlet cannot be installed alongside dnspython<1.10.0. This breaks on Ubuntu 12.04, for example, which ships 1.9.4 as a system package.
There are two parts to the fix:
Since version 1.10.0, dnspython's inet_aton functions would raise dns.exception.SyntaxError on invalid address strings. Prior to that, however, inet_aton was a thin wrapper around socket.inet_aton and would therefore raise socket.error on invalid addresses. So we'll catch either error when checking ipv4/6 addresses.
Additionally, dnspython 1.10.0 introduced the LRUCache class. We should fall back to the interval-based Cache class if LRUCache is not available. Note that it is already being used in clear().
Prior to commit 861d684, either of these would have been caught as an ImportError in eventlet/green/socket.py and we would have just assumed dnspython wasn't available.