Node crashes if timeout (rc: -7) is thrown during init()
See original GitHub issueDescribe the bug If timeout is reached (rc: -7) during the first init() call, I receive the error below and app crashes with code: 139.
Assertion failed: loop->watchers[w->fd] == w
I am sure that app doesn’t use Zookeeper instance until there is a ‘connect’ event (which is never received).
To Reproduce
- Initialize Zookeeper via
.init()
or.connect()
with a timeout set to a tiny value. E.g. 5ms. (This will produce the same effect as on our server, where timeout is set to 10000ms.) - See error.
Error Log
2021-01-11 16:58:46,945:14539:ZOO_INFO@log_env@1102: Client environment:zookeeper.version=zookeeper C client 3.5.8
2021-01-11 16:58:46,945:14539:ZOO_INFO@log_env@1106: Client environment:host.name=project
2021-01-11 16:58:46,945:14539:ZOO_INFO@log_env@1113: Client environment:os.name=Linux
2021-01-11 16:58:46,945:14539:ZOO_INFO@log_env@1114: Client environment:os.arch=4.19.121-linuxkit
2021-01-11 16:58:46,946:14539:ZOO_INFO@log_env@1115: Client environment:os.version=#1 SMP Tue Dec 1 17:50:32 UTC 2020
2021-01-11 16:58:46,946:14539:ZOO_INFO@log_env@1123: Client environment:user.name=(null)
2021-01-11 16:58:46,946:14539:ZOO_INFO@log_env@1131: Client environment:user.home=/home/node
2021-01-11 16:58:46,946:14539:ZOO_INFO@log_env@1143: Client environment:user.dir=/srv
2021-01-11 16:58:46,946:14539:ZOO_INFO@zookeeper_init_internal@1177: Initiating client connection, host=zookeeper:2181 sessionTimeout=5 watcher=0x7f988ef61490 sessionId=0 sessionPasswd=<null> context=0x5623b4960d20 flags=0
2021-01-11 16:58:46,947:14539:ZOO_DEBUG@get_next_server_in_reconfig@1330: [OLD] count=0 capacity=0 next=0 hasnext=0
2021-01-11 16:58:46,947:14539:ZOO_DEBUG@get_next_server_in_reconfig@1333: [NEW] count=1 capacity=16 next=0 hasnext=1
2021-01-11 16:58:46,947:14539:ZOO_DEBUG@get_next_server_in_reconfig@1344: Using next from NEW=172.18.0.2:2181
2021-01-11 16:58:46,947:14539:ZOO_DEBUG@zookeeper_connect@2232: [zk] connect()
Interest in (fd=19, read=true, write=true, timeout=1)
2021-01-11 16:58:46,957:14539:ZOO_WARN@zookeeper_interest@2284: Exceeded deadline by 9ms
zk_timer_cb fired
ping timer went off
2021-01-11 16:58:46,957:14539:ZOO_ERROR@handle_socket_error_msg@2386: Socket [172.18.0.2:2181] zk retcode=-7, errno=110(Operation timed out): connection to 172.18.0.2:2181 timed out (exceeded timeout by 7ms)
2021-01-11 16:58:46,958:14539:ZOO_DEBUG@cleanup@1785: Previous connection=[172.18.0.2:2181] delay=0
yield:zookeeper_interest returned error: -7 - operation timeout
zk_timer_cb fired
ping timer went off
2021-01-11 16:58:46,959:14539:ZOO_WARN@zookeeper_interest@2284: Exceeded deadline by 11ms
2021-01-11 16:58:46,960:14539:ZOO_DEBUG@get_next_server_in_reconfig@1330: [OLD] count=0 capacity=0 next=0 hasnext=0
2021-01-11 16:58:46,960:14539:ZOO_DEBUG@get_next_server_in_reconfig@1333: [NEW] count=1 capacity=16 next=1 hasnext=0
2021-01-11 16:58:46,960:14539:ZOO_DEBUG@get_next_server_in_reconfig@1355: Failed to find either new or old
2021-01-11 16:58:46,960:14539:ZOO_DEBUG@zookeeper_connect@2232: [zk] connect()
Assertion failed: loop->watchers[w->fd] == w (../deps/uv/src/unix/core.c: uv__io_stop: 932)
Expected behavior Timeout doesn’t crash node app and closes client connection, so I could recreate client instance and retry to connect.
Desktop (please complete the following information):
- OS: Linux
- Node.js version: v10.23.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:16
Top Results From Across the Web
Unable to catch c exceptions · Issue #238 · yfinkelstein/node- ...
Describe the bug Hey, When our clients has a connection issue to zookeeper, we sometimes ... Node crashes if timeout (rc: -7) is...
Read more >How to stop NodeJS script from crashing when timeout ...
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not...
Read more >Node-Red keeps crashing at home assistant restart
Hi guys, Since a few days, my node-red is been having some problems. Whenever I restart home-assistant, it is not able to start...
Read more >Xcode 13 Release Notes | Apple Developer Documentation
The Xcode 13 release supports on-device debugging for iOS 9 and later, tvOS 9 and later, and watchOS 2 and later. Xcode 13...
Read more >Fix List for DB2 Version 10.5 for Linux, UNIX and Windows
APAR Sev. Abstract
IJ11422 2 MEMORY LEAK IN DB2TOP WHEN VIEWING DYNAMIC SQL
IT28111 2 QUERIES USING HASH JOINS MAY HANG INTERMITTENTLY
IT29647 2 SIG#11 RUNNING...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
However, adding a setTimeout seemed to help a bit. App is no longer crashing and tries to reconnect.
@DavidVujic I tested under Node v16.14.2. It looks like yield:zookeeper_interest returned error: -7 - operation timeout no longer causes libuv to fail.
Will keep you posted in case issue repeats itself again. For now the issue is solved by updating to Node v16.14.2 or later.
However, timeout issue still persists (eventhough it doesn’t crash node anymore)
Update: Node.js v14.19.1 doesn’t crash as well.