Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>With Zookeeper it turns out there is a hack you can perform in order to allow a session to continue while interrupted in gdb. This hack leverages a few properties of Zookeeper and gdb:</p> <ul> <li>You can have multiple Zookeeper clients with same session ID</li> <li>gdb doesn't stop child processes at parent breakpoints</li> <li>You can ignore gdb signals in a child process without affecting the parent</li> </ul> <p>Based on this, the solution becomes spawning a child process which connects to Zookeeper with the same client id as the parent and does nothing else. Zookeeper clients however have the notion of session moving, where every so often the client will switch which server they are connected to. If you have two clients with same session ID, one of them could move leaving the other connected to a server that doesn't hold their session. To prevent this, the child must only connect to the server the parent is currently connected to. The parent and child thus look like the following:</p> <pre><code>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 </code></pre> <p>I tested this using libzookeeper_mt-0.3.3 and it works as described. Some nastiness starts spewing out of the Zookeeper logs when you do this hack which can be frustrating. If you can't ignore the logs, you can turn them off as follows:</p> <pre><code>zoo_set_debug_level((ZooLogLevel)0); </code></pre> <p>It's an undocumented way in Zookeeper of disabling logging.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload