Qpid
  1. Qpid
  2. QPID-4147

python-qpid client does not handle interrupts on its selector

    Details

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

      Description

      Description of problem:
      python-qpid does not recover if its select() call within the Selector class has been interrupted. This is a problem when setuid() is called after a connection object has been created (hence a new thread has been created).

      Version-Release number of selected component (if applicable):
      python-qpid-0.14
      python-qpid-0.12

      How reproducible:
      Always.

      Steps to Reproduce:
      1. Create a queue called justin
      2. Run the following program:

      #!/usr/bin/python
      import os, sys, time
      from qpid.messaging import Connection
      from qpid.messaging import Message

      addressdefault = 'localhost:5672'

      if len(sys.argv) != 2:
      host = addressdefault
      else:
      host = sys.argv[1]

      def do_message():
      conn = Connection(host)
      conn.open()
      sess = conn.session()
      sender = sess.sender('justin')

      message = Message(content='hello world!')
      sender.send(message)

      do_message()

      try:
      os.setuid(500)
      except:
      print "Exception has happened"
      pass

      do_message()

      Actual results:

      Traceback:

      Exception in thread Thread-1:
      Traceback (most recent call last):
      File "/usr/lib64/python2.4/threading.py", line 442, in __bootstrap
      self.run()
      File "/usr/lib64/python2.4/threading.py", line 422, in run
      self._target(*self.args, **self._kwargs)
      File "/usr/lib/python2.4/site-packages/qpid/selector.py", line 119, in run
      rd, wr, ex = select(self.reading, self.writing, (), timeout)
      error: (4, 'Interrupted system call')

      Expected results:

      No traceback.

      1. qpid-selector.patch
        1.0 kB
        Siddhesh Poyarekar

        Activity

        Hide
        Siddhesh Poyarekar added a comment -

        Restart the select() call if it was interrupted with an EINTR.

        Show
        Siddhesh Poyarekar added a comment - Restart the select() call if it was interrupted with an EINTR.
        Hide
        Rafael H. Schloming added a comment -

        I submitted a fix based on the supplied patch.

        Show
        Rafael H. Schloming added a comment - I submitted a fix based on the supplied patch.

          People

          • Assignee:
            Rafael H. Schloming
            Reporter:
            Siddhesh Poyarekar
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development