Race in detaching for 0-10 python client
----------------------------------------

                 Key: QPID-1250
                 URL: https://issues.apache.org/jira/browse/QPID-1250
             Project: Qpid
          Issue Type: Bug
          Components: Python Client
    Affects Versions: M3
            Reporter: Gordon Sim
            Assignee: Gordon Sim
            Priority: Minor
             Fix For: M3


In delegates.py, the session_detach() handler first calls detach on the 
connection which updates the record of attached sessions with the connections 
lock held, then sends the session_detached() response to the peer.

If an application creates a new session between the session being removed from 
the attached set and the detached response being sent, the channel can get 
reused for the new session and there's a race between the sending of detached 
(for the old session) and attach (for the new session) on that same channel.

My suggested fix for this is just to send the detached before actually 
detaching:

Index: qpid/delegates.py
===================================================================
--- qpid/delegates.py   (revision 686688)
+++ qpid/delegates.py   (working copy)
@@ -74,8 +74,8 @@
     notify(ch.session.condition)

   def session_detach(self, ch, d):
+    ch.session_detached(d.name)
     ssn = self.connection.detach(d.name, ch)
-    ch.session_detached(d.name)

   def session_detached(self, ch, d):
     self.connection.detach(d.name, ch) 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to