-
Type: Task
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
As part of PYTHON-3406, I added this line to the pool:
# Avoid the getaddrinfo importlib deadlock on fork() described in PYTHON-3406.
host = host.encode("idna")
Unfortunately, eventlet (which uses dnspython) does not support bytes and the eventlet tests have been failing ever since:
Traceback (most recent call last): File "/Users/shane/git/mongo-python-driver/pymongo/monitor.py", line 213, in _check_server return self._check_once() ... File "/Users/shane/git/mongo-python-driver/pymongo/pool.py", line 1007, in _create_connection for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): File "/Users/shane/work/pycharm/pymongo-py310/lib/python3.10/site-packages/eventlet/support/greendns.py", line 543, in getaddrinfo qname, addrs = _getaddrinfo_lookup(host, family, flags) File "/Users/shane/work/pycharm/pymongo-py310/lib/python3.10/site-packages/eventlet/support/greendns.py", line 526, in _getaddrinfo_lookup answer = resolve(host, family, False) File "/Users/shane/work/pycharm/pymongo-py310/lib/python3.10/site-packages/eventlet/support/greendns.py", line 450, in resolve return _proxy.query(name, rdtype, raise_on_no_answer=raises, File "/Users/shane/work/pycharm/pymongo-py310/lib/python3.10/site-packages/eventlet/support/greendns.py", line 406, in query return end() File "/Users/shane/work/pycharm/pymongo-py310/lib/python3.10/site-packages/eventlet/support/greendns.py", line 385, in end raise result[1] File "/Users/shane/work/pycharm/pymongo-py310/lib/python3.10/site-packages/eventlet/support/greendns.py", line 366, in step a = fun(*args, **kwargs) File "/Users/shane/work/pycharm/pymongo-py310/lib/python3.10/site-packages/dns/resolver.py", line 1110, in query return self.resolve(qname, rdtype, rdclass, tcp, source, File "/Users/shane/work/pycharm/pymongo-py310/lib/python3.10/site-packages/dns/resolver.py", line 1049, in resolve resolution = _Resolution(self, qname, rdtype, rdclass, tcp, File "/Users/shane/work/pycharm/pymongo-py310/lib/python3.10/site-packages/dns/resolver.py", line 551, in __init__ self.qnames_to_try = resolver._get_qnames_to_try(qname, search) File "/Users/shane/work/pycharm/pymongo-py310/lib/python3.10/site-packages/dns/resolver.py", line 888, in _get_qnames_to_try if qname.is_absolute(): AttributeError: 'bytes' object has no attribute 'is_absolute'
Let's change it back to str and open a eventlet/dnspython ticket to support it:
>>> dns.resolver.resolve('mongodb.com') <dns.resolver.Answer object at 0x102a395a0> >>> dns.resolver.resolve('mongodb.com'.encode('idna')) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/shane/work/pycharm/pymongo-py310/lib/python3.10/site-packages/dns/resolver.py", line 1193, in resolve return get_default_resolver().resolve(qname, rdtype, rdclass, tcp, source, File "/Users/shane/work/pycharm/pymongo-py310/lib/python3.10/site-packages/dns/resolver.py", line 1049, in resolve resolution = _Resolution(self, qname, rdtype, rdclass, tcp, File "/Users/shane/work/pycharm/pymongo-py310/lib/python3.10/site-packages/dns/resolver.py", line 551, in __init__ self.qnames_to_try = resolver._get_qnames_to_try(qname, search) File "/Users/shane/work/pycharm/pymongo-py310/lib/python3.10/site-packages/dns/resolver.py", line 888, in _get_qnames_to_try if qname.is_absolute(): AttributeError: 'bytes' object has no attribute 'is_absolute'
- is caused by
-
PYTHON-3406 Using MongoClient causes a deadlock in child after a fork()
- Closed
- links to