python-zk / kazoo

Kazoo is a high-level Python library that makes it easier to use Apache Zookeeper.
https://kazoo.readthedocs.io
Apache License 2.0
1.3k stars 387 forks source link

Fails to start() under the Jython #431

Closed VVasyaev closed 7 years ago

VVasyaev commented 7 years ago
>>> from kazoo.client import KazooClient
>>> zk = KazooClient('127.0.0.1')
>>> zk.start()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\jython2.7.0\Lib\site-packages\kazoo\client.py", line 541, in start
    event = self.start_async()
  File "C:\jython2.7.0\Lib\site-packages\kazoo\client.py", line 576, in start_async
    self._connection.start()
  File "C:\jython2.7.0\Lib\site-packages\kazoo\protocol\connection.py", line 170, in start
    rw_sockets = self.handler.create_socket_pair()
  File "C:\jython2.7.0\Lib\site-packages\kazoo\handlers\threading.py", line 165, in create_socket_pair
    return utils.create_socket_pair(socket)
  File "C:\jython2.7.0\Lib\site-packages\kazoo\handlers\utils.py", line 148, in create_socket_pair
    temp_srv_sock.bind(('', port))
  File "C:\jython2.7.0\Lib\_socket.py", line 1367, in meth
    return getattr(self._sock,name)(*args)
  File "C:\jython2.7.0\Lib\_socket.py", line 812, in bind
    self.bind_addr = _get_jsockaddr(address, self.family, self.type, self.proto, AI_PASSIVE)
  File "C:\jython2.7.0\Lib\_socket.py", line 1565, in _get_jsockaddr
    addr = _get_jsockaddr2(address_object, family, sock_type, proto, flags)
  File "C:\jython2.7.0\Lib\_socket.py", line 1594, in _get_jsockaddr2
    hostname = {AF_INET: INADDR_ANY, AF_INET6: IN6ADDR_ANY_INIT}[family]
KeyError: 0

Under the Python if works fine. But unfortunately i need to use it under the Jython

jeffwidman commented 7 years ago

I'm going to close this because Jython isn't a platform we guarantee support for.

Since this works in Python but not Jython, it sounds like a Jython bug. I'm open to merging a patch that works around the upstream bug as long as the workaround isn't too hacky.