Skip to content
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

Kazoo 2.9.0 throws "Connection dropped: socket connection error: The handle is invalid" #679

Closed
fafairuz opened this issue Nov 3, 2022 · 10 comments · Fixed by #681
Closed
Assignees
Labels

Comments

@fafairuz
Copy link

fafairuz commented Nov 3, 2022

Kazoo 2.9.0 throws Connection dropped: socket connection error: The handle is invalid and from server, I got EndOfStreamException: Unable to read additional data from client, it probably closed the socket: address = /10.1.17.34:3664, session = 0x0

I have tried with previous version (2.8.0) and it is working fine.

Expected Behavior

KazooClient can be started after issuing zk.start()

Actual Behavior

Kazoo returning Connection dropped: socket connection error: The handle is invalid after issuing zk.start()

Snippet to Reproduce the Problem

Python 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from kazoo.client import KazooClient
>>> zk_hosts    = "zookeeper_host_1:2181"
>>> zk = KazooClient(hosts=zk_hosts)
>>> zk.start()
Connection dropped: socket connection error: The handle is invalid
Connection dropped: socket connection error: The handle is invalid
Connection dropped: socket connection error: The handle is invalid
Connection dropped: socket connection error: The handle is invalid
Connection dropped: socket connection error: The handle is invalid
Connection dropped: socket connection error: The handle is invalid
Connection dropped: socket connection error: The handle is invalid
Connection dropped: socket connection error: The handle is invalid
Connection dropped: socket connection error: The handle is invalid
Failed connecting to Zookeeper within the connection retry policy.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python38\lib\site-packages\kazoo\client.py", line 635, in start
    raise self.handler.timeout_exception("Connection time-out")
kazoo.handlers.threading.KazooTimeoutError: Connection time-out
>>>

Logs with logging in DEBUG mode

This is logs from zookeeper host. It is repeated numbers of times.

Nov 03 17:19:39 nsl-zookeeper-02 zkServer.sh[1452]: EndOfStreamException: Unable to read additional data from client, it probably closed the socket: address = /my_client_IP:4089, session = 0x0
Nov 03 17:19:39 nsl-zookeeper-02 zkServer.sh[1452]:         at org.apache.zookeeper.server.NIOServerCnxn.handleFailedRead(NIOServerCnxn.java:163)
Nov 03 17:19:39 nsl-zookeeper-02 zkServer.sh[1452]:         at org.apache.zookeeper.server.NIOServerCnxn.doIO(NIOServerCnxn.java:326)
Nov 03 17:19:39 nsl-zookeeper-02 zkServer.sh[1452]:         at org.apache.zookeeper.server.NIOServerCnxnFactory$IOWorkRequest.doWork(NIOServerCnxnFactory.java:522)Nov 03 17:19:39 nsl-zookeeper-02 zkServer.sh[1452]:         at org.apache.zookeeper.server.WorkerService$ScheduledWorkRequest.run(WorkerService.java:154)
Nov 03 17:19:39 nsl-zookeeper-02 zkServer.sh[1452]:         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
Nov 03 17:19:39 nsl-zookeeper-02 zkServer.sh[1452]:         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
Nov 03 17:19:39 nsl-zookeeper-02 zkServer.sh[1452]:         at java.lang.Thread.run(Thread.java:750)

Specifications

  • Kazoo version: 2.9.0
  • Result of pip list command:
  • Zookeeper version: 3.6.1
  • Zookeeper configuration:
    • 3 instance of zookeeper server
    • zookeeper config:
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/path/to/data/zookeeper
clientPort=2181
metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
metricsProvider.httpPort=7000
metricsProvider.exportJvmInfo=true
4lw.commands.whitelist=mntr,conf,ruok
server.1=...:2888:3888
server.2=...:2888:3888
server.3=...:2888:3888
- Java OpenJDK, `openjdk version "1.8.0_352`
- put here any useful ZK configuration (authentication, encryption, number of ZK members, number of (concurrent?) clients, Java version, krb5 version, etc.)
  • Python version: 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] on win32
  • OS: Windows 10 version 21H2 (OS Build 19044.2130)

Thank you

@StephenSorriaux
Copy link
Member

Hello,

Thanks for reporting this issue.

Thoughts: can it be linked to #656 that may not be working as expected on Windows?

@yanchunhuo
Copy link

I have the same problem~

@StephenSorriaux
Copy link
Member

Hello,

FWIW, I believe I have a fix in #681

@ArneBachmannDLR
Copy link

This issue broke my production server, as I didn't freeze the dependency to 2.8.0... Upgrading ZooKeeper didn't fix the problem either and after thinking/investigating a few days it became clear it's neither client nor server, but the Python library :-)

Workaround: pip install -U "kazoo=2.8.0"

@ceache
Copy link
Contributor

ceache commented Dec 17, 2022 via email

@ArneBachmannDLR
Copy link

The client was on Windows 10 21H2 19044.2364 in an Enterprise setup. The ZooKeeper installation same on a different machine. Access via other tools (like ZKUI) worked fine, but not from Python anymore. Downgrade to 2.8.0 resolved the issue for now.

@jeffwidman
Copy link
Member

@fafairuz @yanchunhuo are you both running on Windows as well?

gdmhrogut added a commit to rostock/geocodr that referenced this issue Jan 27, 2023
gdmhrogut added a commit to rostock/geocodr-mv that referenced this issue Jan 27, 2023
@yanchunhuo
Copy link

@fafairuz @yanchunhuo are you both running on Windows as well?

yes

@jeffwidman
Copy link
Member

@tcalmant @fafairuz @yanchunhuo can one of you test master now that #681 is merged to confirm this is resolved?

We would like to cut a release with the fix to unbreak folks, but first want to confirm this is resolved for you.

@tcalmant
Copy link

Hi @jeffwidman, the master branch works in my use case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants