OpenStack library for messaging
Go to file
Matthew Booth 3f3c489aaf Fix a race calling blocking MessageHandlingServer.start()
This fixes a race due to the quirkiness of the blocking executor. The
blocking executor does not create a separate thread, but is instead
explicitly executed in the calling thread. Other threads will,
however, continue to interact with it.

In the non-blocking case, the executor will have done certain
initialisation in start() before starting a worker thread and
returning control to the caller. That is, the caller can be sure that
this initialisation has occurred when control is returned. However, in
the blocking case, control is never returned. We currently work round
this by setting self._running to True before executing executor.start,
and by not doing any locking whatsoever in MessageHandlingServer.
However, this current means there is a race whereby executor.stop()
can run before executor.start(). This is fragile and extremely
difficult to reason about robustly, if not currently broken.

The solution is to split the initialisation from the execution in the
blocking case. executor.start() is no longer a blocking operation for
the blocking executor. As for the non-blocking case, executor.start()
returns as soon as initialisation is complete, indicating that it is
safe to subsequently call stop(). Actual execution is done explicitly
via the new execute() method, which blocks.

In doing this, we also make FakeBlockingThread a more complete
implementation of threading.Thread. This fixes a related issue in
that, previously, calling server.wait() on a blocking executor from
another thread would not wait for the completion of the executor. This
has a knock-on effect in test_server's ServerSetupMixin. This mixin
created an endpoint with a stop method which called server.stop().
However, as this is executed by the executor, and also joins the
executor thread, which is now blocking, this results in a deadlock. I
am satisfied that, in general, this is not a sane thing to do.
However, it is useful for these tests. We fix the tests by making the
stop method non-blocking, and do the actual stop and wait calls from
the main thread.

Change-Id: I0d332f74c06c22b44179319432153e15b69f2f45
2015-10-21 09:43:52 +01:00
doc/source Remove unnecessary rpc_zmq_port option 2015-10-02 13:10:35 +03:00
etc Fix spelling typo in output 2015-09-24 18:11:22 +08:00
oslo_messaging Fix a race calling blocking MessageHandlingServer.start() 2015-10-21 09:43:52 +01:00
oslo.messaging/locale Imported Translations from Zanata 2015-09-16 18:44:52 +00:00
tools Adapt functional tests to pika-driver 2015-10-07 19:06:07 +03:00
.coveragerc Change ignore-errors to ignore_errors 2015-09-21 14:43:07 +00:00
.gitignore Ignore any egg and egg-info directories 2014-02-05 09:32:25 -08:00
.gitreview Add oslo.messaging project infrastructure 2013-06-15 08:43:50 +01:00
.testr.conf Workaround test stream corruption issue 2015-10-05 22:38:34 +00:00
babel.cfg Setup for translation 2014-06-05 22:48:44 +02:00
CONTRIBUTING.rst Workflow documentation is now in infra-manual 2014-12-05 03:30:39 +00:00
LICENSE Add oslo.messaging project infrastructure 2013-06-15 08:43:50 +01:00
MANIFEST.in Add oslo.messaging project infrastructure 2013-06-15 08:43:50 +01:00
README.rst Switch badges from 'pypip.in' to 'shields.io' 2015-06-11 20:38:19 -07:00
requirements.txt Updated from global requirements 2015-10-17 20:59:44 +00:00
setup-test-env-qpid.sh Disable ACL if authentication cannot be performed. 2015-09-16 16:33:58 -04:00
setup-test-env-rabbit.sh Don't use devstack to setup our functional env 2015-06-11 12:01:01 +02:00
setup-test-env-zmq.sh Non-blocking outgoing queue was implemented 2015-09-28 14:14:53 +03:00
setup.cfg Merge "Non-blocking outgoing queue was implemented" 2015-09-30 16:11:29 +00:00
setup.py Updated from global requirements 2015-09-17 12:16:04 +00:00
test-requirements.txt Updated from global requirements 2015-10-02 17:11:34 +00:00
tox.ini AMQP1.0: Turn off debug tracing when running tox 2015-10-09 10:32:32 -04:00

Oslo Messaging Library

Latest Version

Downloads

The Oslo messaging API supports RPC and notifications over a number of different messaging transports.