Frank Quinn created PROTON-346:
----------------------------------

             Summary: Deadlock experienced in pn_messenger_stop
                 Key: PROTON-346
                 URL: https://issues.apache.org/jira/browse/PROTON-346
             Project: Qpid Proton
          Issue Type: Bug
          Components: proton-c
    Affects Versions: 0.4
            Reporter: Frank Quinn
            Priority: Critical
         Attachments: qpid_deadlock_repro.c

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).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to