Qpid
  1. Qpid
  2. QPID-3218

AttributeError: 'NoneType' object has no attribute 'write_cmds'

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.7
    • Fix Version/s: 0.11
    • Component/s: Python Client
    • Labels:
      None
    • Environment:

      Description

      2011-04-19 22:05:07,321 [ERROR][asynctaskreplyqueue] __fetch() @ consumer.py:90 - asynctaskreplyqueue
      Traceback (most recent call last):
      File "/usr/lib/python2.6/site-packages/gofer/messaging/consumer.py", line 86, in __fetch
      return self.receiver.fetch(timeout=self.WAIT)
      File "<string>", line 6, in fetch
      File "/usr/lib/python2.6/site-packages/qpid/messaging/endpoints.py", line 994, in fetch
      self._ecwait(lambda: self.linked)
      File "/usr/lib/python2.6/site-packages/qpid/messaging/endpoints.py", line 50, in _ecwait
      result = self._ewait(lambda: self.closed or predicate(), timeout)
      File "/usr/lib/python2.6/site-packages/qpid/messaging/endpoints.py", line 957, in _ewait
      result = self.session._ewait(lambda: self.error or predicate(), timeout)
      File "/usr/lib/python2.6/site-packages/qpid/messaging/endpoints.py", line 550, in _ewait
      result = self.connection._ewait(lambda: self.error or predicate(), timeout)
      File "/usr/lib/python2.6/site-packages/qpid/messaging/endpoints.py", line 194, in _ewait
      self.check_error()
      File "/usr/lib/python2.6/site-packages/qpid/messaging/endpoints.py", line 187, in check_error
      raise self.error
      InternalError: Traceback (most recent call last):
      File "/usr/lib/python2.6/site-packages/qpid/messaging/driver.py", line 496, in dispatch
      self.engine.dispatch()
      File "/usr/lib/python2.6/site-packages/qpid/messaging/driver.py", line 791, in dispatch
      self.attach(ssn)
      File "/usr/lib/python2.6/site-packages/qpid/messaging/driver.py", line 834, in attach
      self.link(rcv, self._in, rcv.source)
      File "/usr/lib/python2.6/site-packages/qpid/messaging/driver.py", line 885, in link
      dir.do_unlink(sst, lnk, _lnk)
      File "/usr/lib/python2.6/site-packages/qpid/messaging/driver.py", line 261, in do_unlink
      sst.write_cmds(cmds, action)
      AttributeError: 'NoneType' object has no attribute 'write_cmds'

      1. test.py
        2 kB
        Gordon Sim

        Issue Links

          Activity

          Justin Ross made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Gordon Sim made changes -
          Link This issue is duplicated by QPID-3290 [ QPID-3290 ]
          Gordon Sim made changes -
          Link This issue is duplicated by QPID-3212 [ QPID-3212 ]
          Gordon Sim made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 0.11 [ 12316272 ]
          Resolution Fixed [ 1 ]
          Gordon Sim made changes -
          Assignee Rafael H. Schloming [ rhs ] Gordon Sim [ gsim ]
          Gordon Sim made changes -
          Assignee Rafael H. Schloming [ rhs ]
          Hide
          Gordon Sim added a comment -

          Rafi, can you review the suggested fix here?

          Show
          Gordon Sim added a comment - Rafi, can you review the suggested fix here?
          Hide
          Gordon Sim added a comment -

          I believe what is happening here is that a session_dectahed can result in the SessionState being removed from the attachments map, but the Engine.attach() method will proceed regardless of that fact and may then hit these types of errors on any linking/unlinking work. This certainly explains my case above and could explain the original trace. It would however most likely be accompanied by some error in the broker logs.

          Suggested fix:

          Index: qpid/messaging/driver.py
          ===================================================================
          --- qpid/messaging/driver.py	(revision 1097458)
          +++ qpid/messaging/driver.py	(working copy)
          @@ -828,8 +828,9 @@
               self._closing = True
           
             def attach(self, ssn):
          +    if ssn.closed: return
               sst = self._attachments.get(ssn)
          -    if sst is None and not ssn.closed:
          +    if sst is None:
                 for i in xrange(0, self.channel_max):
                   if not self._sessions.has_key(i):
                     ch = i
          
          Show
          Gordon Sim added a comment - I believe what is happening here is that a session_dectahed can result in the SessionState being removed from the attachments map, but the Engine.attach() method will proceed regardless of that fact and may then hit these types of errors on any linking/unlinking work. This certainly explains my case above and could explain the original trace. It would however most likely be accompanied by some error in the broker logs. Suggested fix: Index: qpid/messaging/driver.py =================================================================== --- qpid/messaging/driver.py (revision 1097458) +++ qpid/messaging/driver.py (working copy) @@ -828,8 +828,9 @@ self._closing = True def attach(self, ssn): + if ssn.closed: return sst = self._attachments.get(ssn) - if sst is None and not ssn.closed: + if sst is None: for i in xrange(0, self.channel_max): if not self._sessions.has_key(i): ch = i
          Gordon Sim made changes -
          Field Original Value New Value
          Attachment test.py [ 12478076 ]
          Hide
          Gordon Sim added a comment -

          The attached simple test results in a similar error:

          qpid.messaging.exceptions.InternalError: Traceback (most recent call last):
          File "/home/gordon/projects/qpid-svn-trunk/python/qpid/messaging/driver.py", line 507, in dispatch
          self.engine.dispatch()
          File "/home/gordon/projects/qpid-svn-trunk/python/qpid/messaging/driver.py", line 810, in dispatch
          self.attach(ssn)
          File "/home/gordon/projects/qpid-svn-trunk/python/qpid/messaging/driver.py", line 851, in attach
          self.link(snd, self._out, snd.target)
          File "/home/gordon/projects/qpid-svn-trunk/python/qpid/messaging/driver.py", line 894, in link
          self.resolve_declare(sst, _lnk, dir.DIR_NAME, resolved)
          File "/home/gordon/projects/qpid-svn-trunk/python/qpid/messaging/driver.py", line 955, in resolve_declare
          self.resolve(sst, lnk.name, do_resolved, force=declare)
          File "/home/gordon/projects/qpid-svn-trunk/python/qpid/messaging/driver.py", line 981, in resolve
          sst.write_query(ExchangeQuery(name), do_result)
          AttributeError: 'NoneType' object has no attribute 'write_query'

          Attaching in case reproducing that sheds light on the larger issue. (note this is the same test as for the unrelated QPID-3242 but with the actual send/fetch commented out).

          Show
          Gordon Sim added a comment - The attached simple test results in a similar error: qpid.messaging.exceptions.InternalError: Traceback (most recent call last): File "/home/gordon/projects/qpid-svn-trunk/python/qpid/messaging/driver.py", line 507, in dispatch self.engine.dispatch() File "/home/gordon/projects/qpid-svn-trunk/python/qpid/messaging/driver.py", line 810, in dispatch self.attach(ssn) File "/home/gordon/projects/qpid-svn-trunk/python/qpid/messaging/driver.py", line 851, in attach self.link(snd, self._out, snd.target) File "/home/gordon/projects/qpid-svn-trunk/python/qpid/messaging/driver.py", line 894, in link self.resolve_declare(sst, _lnk, dir.DIR_NAME, resolved) File "/home/gordon/projects/qpid-svn-trunk/python/qpid/messaging/driver.py", line 955, in resolve_declare self.resolve(sst, lnk.name, do_resolved, force=declare) File "/home/gordon/projects/qpid-svn-trunk/python/qpid/messaging/driver.py", line 981, in resolve sst.write_query(ExchangeQuery(name), do_result) AttributeError: 'NoneType' object has no attribute 'write_query' Attaching in case reproducing that sheds light on the larger issue. (note this is the same test as for the unrelated QPID-3242 but with the actual send/fetch commented out).
          Hide
          Gordon Sim added a comment -

          The attachment for a receivers session is not set... somewhat similar (to the uninformed at any rate) to QPID-3212

          Show
          Gordon Sim added a comment - The attachment for a receivers session is not set... somewhat similar (to the uninformed at any rate) to QPID-3212
          Jeff Ortel created issue -

            People

            • Assignee:
              Gordon Sim
              Reporter:
              Jeff Ortel
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development