Uploaded image for project: 'Qpid Proton'
  1. Qpid Proton
  2. PROTON-346

Deadlock experienced in pn_messenger_stop


    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: proton-0.4
    • Fix Version/s: proton-0.5
    • Component/s: proton-c
    • Labels:


      Hi Folks,

      See attached code: I'm encountering a deadlock when I try to stop messengers. The general workflow is:

      1. Create pub and sub Messengers
      2. Start the Messengers
      3. Thread sub off onto its own thread as recv is a blocking call
      4. Publish round trip from the pub messenger to the sub messenger with a destroy subject (recv is uninteruptable at the moment so this is our only to interrupt it)
      5. Stop the messengers

      When I try and stop the messengers, the application deadlocks with the following backtrace (there is only one thread running at this point as the subscribe thread has since exited):

      Thread 1 (Thread 0x7f38181a4840 (LWP 6688)):
      #0 0x0000003518ce99ad in poll () at ../sysdeps/unix/syscall-template.S:81
      #1 0x000000309c226a1c in poll (__timeout=<optimized out>, __nfds=<optimized out>, __fds=<optimized out>)
      at /usr/include/bits/poll2.h:46
      #2 pn_driver_wait_2 (d=d@entry=0x1a81140, timeout=<optimized out>, timeout@entry=-1)
      at /usr/src/debug/qpid-proton-0.4/proton-c/src/posix/driver.c:752
      #3 0x000000309c226c42 in pn_driver_wait (d=0x1a81140, timeout=timeout@entry=-1)
      at /usr/src/debug/qpid-proton-0.4/proton-c/src/posix/driver.c:807
      #4 0x000000309c2242d3 in pn_messenger_tsync (messenger=0x1a81050,
      predicate=0x309c222d80 <pn_messenger_stopped>, timeout=<optimized out>)
      at /usr/src/debug/qpid-proton-0.4/proton-c/src/messenger.c:623
      #5 0x0000000000400ffb in main () at qpid_deadlock_repro.c:123

      I also tried adding the entire subscriber messenger workflow to the newly created thread but the same behaviour persists (I'll be attaching the code to recreate this shortly).




            • Assignee:
              fquinn Frank Quinn
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: