commit | 037c5738734d8fecb7b7f7e7af4e4f14f9cd3a64 | [log] [tgz] |
---|---|---|
author | Alan Conway <aconway@redhat.com> | Fri Sep 23 17:23:55 2016 -0400 |
committer | Alan Conway <aconway@redhat.com> | Fri Sep 23 17:26:39 2016 -0400 |
tree | 7cd14cdd8dc4845d9b6c08aaa78d0ec94515b611 | |
parent | 81f09ae33839b7048a08bdf5b7405d64a1446b27 [diff] |
QPID-7317: Fix hangs in qpid.messaging. Hang is observed in processes using qpid.messaging with a thread blocked waiting for the Selector to wake it, but no Selector.run thread. This patch removes all the known ways that this hang can occur. Either we function normally or immediately raise an exception and log to the "qpid.messaging" logger a message starting with "qpid.messaging:" The following issues are fixed: 1. The Selector.run() thread raises a fatal exception. Use of qpid.messaging will re-raise the exception immediately, not hang. 2. The process forks, so child has no Selector thread. https://issues.apache.org/jira/browse/QPID-5637 resets the Selector after a fork. In addition we now: - Close Selector.waiter: its file descriptors are shared with the parent which can cause havoc if they "steal" each other's wakeups. - Replace Endpoint._lock in related endpoints with a BrokenLock. If the parent is holding locks when it forks, they remain locked forever in the child. BrokenLock.acquire() raises instead of hanging. 3. Selector.stop() called on atexit. Selector.stop was registered via atexit, which could cause a hang if qpid.messaging was used in a later-executing atexit function. That has been removed, Selector.run() is in a daemon thread so there is no need for stop() 4. User calls Selector.stop() directly There is no reason to do this for the default Selector used by qpid.messaging, so for that case stop() is now ignored. It works as before for code that creates its own qpid.Selector instances.
This distribution contains a Python client implementation and AMQP conformance tests for Apache Qpid.
You can read more about Qpid here:
Documentation can be found here:
Make sure the Qpid Python client libraries are on your PYTHONPATH. Extract the archive and add the local directory to your PYTHONPATH:
$ tar -xf qpid-python-VERSION.tar.gz $ cd qpid-python-VERSION $ export PYTHONPATH=$PWD:$PYTHONPATH
Make sure a broker is running.
Run the ‘hello’ example from examples/api:
$ cd examples/api $ ./hello Hello world!
The examples
directory contains sample programs. See examples/README.txt
for more information.
The tests
directory contains a collection of unit tests for the Python client. The tests_0-10
, tests_0-9
, and tests_0-8
directories contain protocol-level conformance tests for brokers that speak the specified AMQP version.
The qpid-python-test
script may be used to run these tests. It will by default run the Python unit tests and the 0-10 conformance tests:
Run a broker on the default port.
Run the tests:
$ ./qpid-python-test
If you wish to run the 0-8 or 0-9 conformence tests, they may be selected as follows:
Run a broker on the default port.
Run the tests:
$ ./qpid-python-test tests_0-8.* [or] $ ./qpid-python-test tests_0-9.*
See the qpid-python-test
command-line help for for additional options:
$ ./qpid-python-test -h
Other Qpid components depend on Qpid Python for testing. You can use setup.py
to install Qpid Python to a standard location:
# User-local install $ python setup.py install --user $ export PYTHONPATH=$HOME/.local/lib/python2.7/site-packages $ export PATH=$HOME/.local/bin:$PATH [or] # System-wide install $ sudo python setup.py install