pombreda / gevent

Automatically exported from code.google.com/p/gevent
0 stars 0 forks source link

monkey.patch_dns causes subsequent socket.gethostbyname() to throw DNSError #111

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am using gevent 0.13.6, Python 2.7.2, libevent 2.0.16. The OS is OS X 10.7.2 
Python and libevent were installed via Homebrew.

python -c "from gevent.core import *; print get_method(), get_version()" output:
kqueue 2.0.16-stable

Here is a test program that causes the exception, commenting out patch_dns 
makes it work correctly:

=== snip ===
#!/usr/bin/env python
from gevent.monkey import patch_dns
patch_dns()

import socket

print socket.gethostbyname('google.com')
=== snip ===

The traceback:

Traceback (most recent call last):
  File "dnslookup.py", line 6, in <module>
    print socket.gethostbyname('google.com')
  File ".../lib/python2.7/site-packages/gevent/socket.py", line 683, in gethostbyname
    _ttl, addrs = resolve_ipv4(hostname)
  File ".../lib/python2.7/site-packages/gevent/dns.py", line 59, in resolve_ipv4
    raise DNSError(result)
gevent.dns.DNSError: [Errno 3] name does not exist

Original issue reported on code.google.com by kristaps.rats@gmail.com on 29 Dec 2011 at 3:18

GoogleCodeExporter commented 9 years ago
Can you try gevent 1.0a3? 

You can get it there: http://code.google.com/p/gevent/downloads/list

Original comment by Denis.Bi...@gmail.com on 29 Dec 2011 at 3:47

GoogleCodeExporter commented 9 years ago
Works correctly with 1.0a3. 

Perhaps there is a known workaround for this problem? If not, how usable is 1.0 
right now? Would you recommend to use it instead of 0.13.6? 

Original comment by kristaps.rats@gmail.com on 30 Dec 2011 at 7:52

GoogleCodeExporter commented 9 years ago
1.0a3 is quite stable and usable.

I use it myself in production and others do too (for example, Wikipedia: 
http://gevent.org/success.html#pediapress)

Original comment by Denis.Bi...@gmail.com on 30 Dec 2011 at 9:14

GoogleCodeExporter commented 9 years ago
Any estimate on when you'll consider 1.0 to be stable enough to be added to 
PyPI?

Original comment by kristaps.rats@gmail.com on 30 Dec 2011 at 9:26

GoogleCodeExporter commented 9 years ago
Migrated to http://github.com/SiteSupport/gevent/issues/111

Original comment by Denis.Bi...@gmail.com on 14 Sep 2012 at 10:52