Skip to content

Attempting to get the zookeeper server version crashes (python3.13) #770

@ThosRTanner

Description

@ThosRTanner

Expected Behavior

kazooClient.server_version() should return a tuple with the server version

Actual Behavior

I get an exception in the SSL layer:

Traceback (most recent call last):
"mycode.py", line 530, in _state_listener
    version = self._zk.server_version()
  File ".../python/lib/python3.13/site-packages/kazoo/client.py", line 823, in server_version
    version = _try_fetch()
  File ".../python/lib/python3.13/site-packages/kazoo/client.py", line 794, in _try_fetch
    data = self.command(b\"envi\")
  File ".../python/lib/python3.13/site-packages/kazoo/client.py", line 766, in command
    sock = self.handler.create_connection(
        peer,
    ...<8 lines>...
        check_hostname=self.check_hostname,
    )
  File ".../python/lib/python3.13/site-packages/kazoo/handlers/threading.py", line 174, in create_connection
    return utils.create_tcp_connection(socket, *args, **kwargs)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "python/lib/python3.13/site-packages/kazoo/handlers/utils.py", line 266, in create_tcp_connection
    conn = context.wrap_socket(
        module.socket(addrs[0][0]), server_hostname=hostname
    )
  File ".../python3.13/ssl.py", line 455, in wrap_socket
    return self.sslsocket_class._create(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        sock=sock,
        ^^^^^^^^^^
    ...<5 lines>...
        session=session
        ^^^^^^^^^^^^^^^
    )
    ^
  File ".../python3.13/ssl.py", line 1021, in _create
    self.server_hostname = context._encode_hostname(server_hostname)
                           ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File ".../python3.13/ssl.py", line 447, in _encode_hostname
    return hostname.decode('ascii')
           ^^^^^^^^^^^^^^^
AttributeError: 'int' object has no attribute 'decode'"

Snippet to Reproduce the Problem

See above for code snippet

Logs with logging in DEBUG mode

See above

Specifications

  • Kazoo version: Kazoo 2.10.0
  • Result of pip list command: (Note - this has all my dev stuff which may be excessive)
Package                               Version
------------------------------------- -------------------------------------------------
astroid                               4.0.2
attrs                                 25.4.0
cachetools                            6.2.4
chardet                               5.2.0
colorama                              0.4.6
coverage                              7.13.0
dill                                  0.4.0
distlib                               0.4.0
dnspython                             2.8.0
docopt-ng                             0.9.0
filelock                              3.20.1
flake8                                7.3.0
flake8-picky-parentheses              0.6.1
freezegun                             1.5.5
iniconfig                             2.3.0
isort                                 7.0.0
Jinja2                                3.1.6
jsonschema                            4.25.1
jsonschema-specifications             2025.9.1
kazoo                                 2.10.0
librt                                 0.7.4
linkify-it-py                         2.0.3
markdown-it-py                        4.0.0
MarkupSafe                            3.0.3
mccabe                                0.7.0
mdit-py-plugins                       0.5.0
mdurl                                 0.1.2
memray                                1.19.1
mypy                                  1.19.1
mypy_extensions                       1.1.0
packaging                             25.0
pathspec                              0.12.1
pip                                   25.3
platformdirs                          4.5.1
pluggy                                1.6.0
psutil                                7.2.2
pycodestyle                           2.14.0
pyflakes                              3.4.0
Pygments                              2.19.2
pylint                                4.0.4
pyproject-api                         1.10.0
pytest                                9.0.2
pytest-cov                            7.0.0
python-dateutil                       2.9.0.post0
python-json-logger                    4.0.0
PyYAML                                6.0.3
referencing                           0.37.0
rich                                  14.2.0
rpds-py                               0.30.0
ruff                                  0.14.10
six                                   1.17.0
structlog                             25.5.0
textual                               6.11.0
tomlkit                               0.13.3
tox                                   4.32.0
types-psutil                          7.2.2.20260130
types-PyYAML                          6.0.12
typing_extensions                     4.15.0
uc-micro-py                           1.0.3
unittest-parametrize                  1.8.0
virtualenv                            20.35.4
yamllint                              1.37.1
  • Zookeeper version: 3.9.2
  • Zookeeper configuration: put here any useful ZK configuration (authentication, encryption, number of ZK members, number of (concurrent?) clients, Java version, krb5 version, etc.) There are 9 nodes in the ensemble but the rest I don't know
  • Python version: 3.13.12
  • OS: Linux Red Hat Enterprise Linux release 8.10 (Ootpa)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions