1216 Commits

Author SHA1 Message Date
Sean Dague
e5b15ce642 Revert "Robustify locking in MessageHandlingServer"
This reverts commit d700c382791b6352bb80a0dc455589085881669f.

This commit is causing a timeout/lock wait condition when using the in 
memory rpc bus. It exposed in the Nova unit / functional tests which use
this extensively.

Change-Id: I9610a5533383955f926dbbb78ab679f45cd7bcdb
Closes-Bug: #1514876
2015-11-10 15:34:05 +00:00
Matthew Booth
d700c38279 Robustify locking in MessageHandlingServer
This change formalises locking in MessageHandlingServer. It allows the
user to make calls in any order and it will ensure, with locking, that
these will be reordered appropriately. It also adds locking for
internal state when using the blocking executor, which closes a number
of races.

It fixes a regression introduced in change
gI3cfbe1bf02d451e379b1dcc23dacb0139c03be76. If multiple threads called
wait() simultaneously, only 1 of them would wait and the others would
return immediately, despite message handling not having completed.
With this change only 1 will call the underlying wait, but all will
wait on its completion.

We add a common logging mechanism when waiting too long. Specifically,
we now log a single message when waiting on any lock for longer than
30 seconds.

We remove DummyCondition as it no longer has any users.

Change-Id: I9d516b208446963dcd80b75e2d5a2cecb1187efa
2015-10-23 16:15:06 +01:00
Jenkins
b93d208543 Merge "Trivial locking cleanup in test_listener" 2015-10-22 12:41:33 +00:00
Jenkins
cf8951aa77 Merge "Remove unused event in ServerThreadHelper" 2015-10-22 12:41:12 +00:00
Jenkins
22e574ff03 Merge "Fix a race calling blocking MessageHandlingServer.start()" 2015-10-21 16:36:33 +00:00
Jenkins
e52cca3ace Merge "Fix assumptions in test_server_wait_method" 2015-10-21 16:36:27 +00:00
Jenkins
87ad4c77ff Merge "Rename MessageHandlingServer._executor for readability" 2015-10-21 16:36:00 +00:00
Matthew Booth
a6da2a98c3 Trivial locking cleanup in test_listener
ListenerSetupMixin.ThreadTracker was reading self._received_msgs
unlocked and sleep/looping until the desired value was reached.
Replaced this pattern with a threading.Condition.

Change-Id: Id4731caee2104bdb231e78e7b460905a0aaf84bf
2015-10-21 11:38:50 +01:00
Matthew Booth
f9b14c0337 Remove unused event in ServerThreadHelper
Change-Id: Ib9ebe363f29cf9a0034550ad852882c2cde8bb49
2015-10-21 11:36:28 +01:00
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
Matthew Booth
9d74ee40c6 Fix assumptions in test_server_wait_method
test_server_wait_method was calling server.wait without having
previously called server.start and server.stop. This happened to work
because it also injected server._executor_obj. This is problematic,
though, as it assumes internal details of the server and does not
represent the calling contract of server.wait, which is that it must
follow server.stop (which must itself also follow server.start).

This change makes the necessary changes to call server.wait in the
correct sequence.

Change-Id: I205683ac6e0f2d64606bb06d08d3d1419f7645f4
2015-10-21 09:43:52 +01:00
Matthew Booth
aec50602d5 Rename MessageHandlingServer._executor for readability
MessageHandlingServer has both MessageHandlingServer.executor, which
is the name of an executor type, and MessageHandlingServer._executor,
which is an instance of that type. Ideally we would rename
MessageHandlingServer.executor, but as this is referenced from outside
the class we change _executor instead to _executor_obj.

Change-Id: Id69ba7a0729cc66d266327dac2fd4eab50f2814c
2015-10-21 09:43:52 +01:00
OpenStack Proposal Bot
a3fa8ffec9 Updated from global requirements
Change-Id: I882a029c98255087bee77ac54c0bf0538f53db33
2015-10-19 23:32:00 +00:00
OpenStack Proposal Bot
4f49b7e253 Updated from global requirements
Change-Id: I25dfe910d67c63a375795fa0abb81a425ef4218c
2015-10-17 20:59:44 +00:00
Jenkins
ac1cb20e0d Merge "Add if condition for random.shuffle" 2015-10-17 03:20:23 +00:00
Jenkins
d1f1d46d74 Merge "Small grammar messaging fix" 2015-10-16 19:35:48 +00:00
OpenStack Proposal Bot
c4efc9ab87 Updated from global requirements
Change-Id: I518fcdffcb36f45c7bd765ba5c826f30a31b5049
2015-10-16 01:00:01 +00:00
Jenkins
947ccd7794 Merge "Provide the executor 'wait' function a timeout and use it" 2015-10-15 08:02:32 +00:00
OpenStack Proposal Bot
822217e427 Updated from global requirements
Change-Id: Ic0b13a01a893cda05658af18d40cc4957dfec839
2015-10-15 00:08:36 +00:00
Joshua Harlow
45d1cf1083 Small grammar messaging fix
Change-Id: I9de501ceb237eed020dbbf080cb044b45dd719d6
2015-10-14 08:02:56 -07:00
Mehdi Abaakouk
c68266b36b Use a condition (and/or a dummy one) instead of a lock
Instead of having to spin in the wait method, just use
a condition and block until stopping has actually happened,
when stop happens, it will use the notify_all method to let
any blockers release.

Closes-Bug: #1505730

Change-Id: I3cfbe1bf02d451e379b1dcc23dacb0139c03be76
2015-10-13 21:24:28 -07:00
Jenkins
68a67f8dc7 Merge "Updated from global requirements" 2015-10-13 15:10:45 +00:00
Jenkins
d864712670 Merge "Workaround test stream corruption issue" 2015-10-13 11:25:51 +00:00
Jenkins
8de08f1c2e Merge "AMQP1.0: Turn off debug tracing when running tox" 2015-10-13 11:25:38 +00:00
OpenStack Proposal Bot
04b53f3cba Updated from global requirements
Change-Id: I85ea29a80ed55776942565a6b374eebd3d52b6f9
2015-10-13 01:00:22 +00:00
Oleksii Zamiatin
974f7d3a91 Fix failures when zmq is not available.
Observe a lot of crashes in services tests since 2.6.0 release.

Change-Id: I70e722e6553a9271b61dd54ffbba3f649d531b84
2.6.1
2015-10-12 20:09:21 +03:00
Jenkins
80e20243a5 Merge "Fix typo in rpc/server.py and notify/listener.py" 2015-10-12 10:51:16 +00:00
Jenkins
fb90b4a243 Merge "Adapt functional tests to pika-driver" 2.6.0 2015-10-09 19:40:51 +00:00
Jenkins
8e46c46ff3 Merge "Fix a typo in server.py" 2015-10-09 17:38:35 +00:00
Kenneth Giusti
23c68ca439 AMQP1.0: Turn off debug tracing when running tox
Change-Id: I0a3da5441db4ab45ed6e5671d2612db104edf3a0
Closes-Bug: #1504563
2015-10-09 10:32:32 -04:00
Jenkins
aee3b94d23 Merge "Use the hostname from the Transport for GSSAPI Authentication" 2015-10-09 14:08:22 +00:00
Daisuke Fujita
64fb61d37c Fix typo in rpc/server.py and notify/listener.py
1. "messaging configuration configuration" to "messaging configuration"

Change-Id: Icda5d2df67cc4d2d0e0cb3a453d0b04dd998e5f4
2015-10-09 22:20:51 +09:00
Daisuke Fujita
a0b760d8fd Fix a typo in server.py
1. "still be some some existing" to "still be some existing"

Change-Id: Id620bb6622123a15f08e3d7e49c7bf3cb7a5e1fc
2015-10-09 12:58:36 +00:00
Jenkins
367e28b0f1 Merge "Skip Redis specific tests when it is not installed" 2015-10-08 22:26:21 +00:00
Kenneth Giusti
1b605c1466 Use the hostname from the Transport for GSSAPI Authentication
Previously, the AMQP 1.0 driver did not pass the proper hostname to
pyngus.  This prevented GSSAPI authentication from working properly.

Change-Id: Ibc6678e7cbae6dd5108d1650dbb8ddf837aa3648
Closes-Bug: #1503258
2015-10-08 14:06:33 -04:00
Jenkins
7eadea5bec Merge "AMQP 1.0: Properly initialize AMQP 1.0 configuration options" 2015-10-08 13:57:21 +00:00
Dmitriy Ukhlov
f025639d8c Adapt functional tests to pika-driver
In this patch conf object passing through the fixtures to
objects is added

Also conf.prog and conf.project attributes are initialized
for tests

Change-Id: I4094043c3ea61cfd37cc998f140d506d4136e681
Partial-Implements: bp rabbit-pika
2015-10-07 19:06:07 +03:00
Davanum Srinivas
d9bb2f4b94 ConfFixture should work even when zmq/redis is not present
Previous driver and other locations in the code we used
zmq_async.import_zmq() and importutils.try_import() to
not fail fast when pyzmq and redis python packages are
not installed. If we don't do this, we are going to break
Nova/Cinder/Glance etc.

Closes-Bug: #1503499
Change-Id: I1529241b5e1d902b37d6b610646a5a46a18f13b0
2015-10-07 12:41:31 +03:00
Jenkins
543d303bfd Merge "Added matchmaker timeouts and retries" 2015-10-06 20:28:13 +00:00
Alexi Yelistratov
5e4cddf7ef Added matchmaker timeouts and retries
Fixed and restored previously skipped test CallTestCase.test_timeout
_connect_to_host() and get_single_hosts() now accept optional timeout
parameter.
_connect_to_host() accepts optional retry parameter
If timeout value (in seconds) is greater than 0, the connection attempts
will be retried $retry times with a specified timeout.

Change-Id: I1c897d917d0defda581b8ff62e7a67e32f011fee
Closes-Bug: #1499713
2015-10-06 20:16:14 +03:00
Kenneth Giusti
4efd89f7c2 AMQP 1.0: Properly initialize AMQP 1.0 configuration options
This patch adds AMQP 1.0 configuration options to the ConfFixture
class.

Change-Id: I01e7113358967939f22d6bc452b03e80101c9814
Closes-Bug: #1503299
2015-10-06 12:07:04 -04:00
OpenStack Proposal Bot
3b5d300512 Updated from global requirements
Change-Id: I1e601c782a7463416db52470bf2812f9e95c79c2
2015-10-05 23:17:50 +00:00
Davanum Srinivas
34d24b79ab Workaround test stream corruption issue
We don't see it right now in logstash as we fail with
a Segmentation fault (core dumped) because of other
issues. But will end up seeing it once that is fixed.

Closes-Bug: #1492505
Change-Id: I6507e693fc929e03884f933bbda241f744d3a7c0
2015-10-05 22:38:34 +00:00
Davanum Srinivas
1cb51c8983 Skip Redis specific tests when it is not installed
Change-Id: I08d7fcb62966c56538bf1581fe19bb38d350e38b
2015-10-05 15:09:23 -07:00
Jenkins
76a6a7608b Merge "Remove unnecessary rpc_zmq_port option" 2015-10-04 22:46:08 +00:00
Kenneth Giusti
3419c95207 Port the AMQP 1.0 driver to Python 3
Minor syntax fixes to allow the AMQP 1.0 driver to run under Python
2.7 and 3.4.

Closes-Bug: #1477124
Change-Id: I8512bb8274fad78285ab59797ba9b3f0f8b5c171
2015-10-03 18:42:33 +02:00
Jenkins
29dc193179 Merge "rabbit: shuffle hosts before building kombu URL" 2015-10-03 02:03:50 +00:00
John Eckersberg
f2beb5eaf1 rabbit: shuffle hosts before building kombu URL
This restores behavior as it was back in the Juno cycle.  This was
changed in a refactor during the Kilo cycle (973301aa) when the kombu
failover_strategy was set to shuffle.  But the failover_strategy only
affects failovers; it does not influence which host receives the
initial connection.

Thus, if multiple hosts are given, the first host will receive all of
the initial connections.  By shuffling the hosts before building the
URL given to kombu, rudimentary load balancing is achieved and
connections are more evenly spread across broker nodes.

Change-Id: Ieecaf5f286f49302db29df9854359ef5d36b7a89
2015-10-02 13:47:21 -04:00
OpenStack Proposal Bot
7f0d2c78b8 Updated from global requirements
Change-Id: I931405ec0f732d2138270ea2417a9fdd5a4267d5
2015-10-02 17:11:34 +00:00
Alexi Yelistratov
74871e0860 Remove unnecessary rpc_zmq_port option
Remove unnecessary rpc_zmq_port option from zmq driver, because zmq
driver doesn't use static port any more - dynamic port binding is used
for running servers.

Closes-Bug: #1497277
Change-Id: I91e978347dd364b2d4c00bc223b0e3ecface7c43
2015-10-02 13:10:35 +03:00