Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4096450
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:02:52+00:00 2026-05-20T20:02:52+00:00

While debugging an application using the Apache Zookeeper C runtime library, I run into

  • 0

While debugging an application using the Apache Zookeeper C runtime library, I run into issues when setting breakpoints with the default all-stop mode in GDB. With the Zookeeper thread being unable to run, the server will timeout the session and thus delete any ephemeral znodes you may have created. Using non-stop mode I can prevent this from occurring, but I lose the convenience of being able to examine the state of any non-Zookeeper thread.

Is there a way in GDB to specify that one (or more) threads will continue running in an application when a breakpoint is hit, but the others will stop running? That way I can examine the state of threads I care about and ignore the state of those I want running in the background.

Edit: This is essentially a duplicate of not stopping all threads in gdb. The solution there to use background commands with non-stop mode essentially solves my problem since I can stop threads and restart them asynchronously whenever I want to, so maybe we should close this one.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T20:02:53+00:00Added an answer on May 20, 2026 at 8:02 pm

    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:

    • You can have multiple Zookeeper clients with same session ID
    • gdb doesn’t stop child processes at parent breakpoints
    • You can ignore gdb signals in a child process without affecting the parent

    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:

    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 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:

    zoo_set_debug_level((ZooLogLevel)0);
    

    It’s an undocumented way in Zookeeper of disabling logging.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one legacy web application based on struts2 (primarily using annotation). While debugging
I have an application using NServiceBus to process messages, and while debugging I'm finding
From times to times, while debugging an Application, I see this error on Xcode:
While debugging crash in a multithreaded application I finally located the problem in this
While debugging a problem in a WPF application, I have noticed that the TwoWay
While debugging a .NET Framework 3.5, WinForms application I spotted some Worker Threads without
I've been getting an error recently while debugging an ASP.NET application in Visual Studio
While debugging an F# application, I would like to be able to invoke an
My problem is, I'm using a TreeView in a UserControl. While debugging, I can
While debugging an application earlier, I noticed in Web Inspector that it appears a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.