In Zookeeper it turns out that you can perform a hack to continue the session, interrupting in gdb. This hack uses several properties of Zookeeper and gdb:
- You may have multiple Zookeeper clients with the same session ID
- gdb does not stop child processes at parent breakpoints
- You can ignore gdb signals in the child process without affecting the parent
Based on this, the solution becomes a child process that connects to Zookeeper with the same client ID as the parent, and does nothing. However, Zookeeper clients have an idea of โโmoving a session, where each client so often switches the server to which they are connected. If you have two clients with the same session ID, one of them can move, leaving the other connected to a server that is not conducting its session. To prevent this, the child node should only connect to the server to which the parent is currently connected. Thus, the parent and child elements are as follows:
Parent(zh): host = zookeeper_get_connected_host(zh) client_id = zoo_client_id(zh) if fork == 0 exec child host client_id end Child(host, client_id): ignore SIGINT zh = zookeeper_init(host, client_id) while(true) sleep end
I tested this with libzookeeper_mt-0.3.3 and it works as described. Some nastiness starts to erupt from Zookeeper magazines when you make this hack that can be frustrating. If you cannot ignore the logs, you can disable them as follows:
zoo_set_debug_level((ZooLogLevel)0);
This is an undocumented way in Zookeeper to turn off logging.
source share