]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Fix IF checks on spawned green thread instance
authorKaiwei Fan <fank@vmware.com>
Thu, 5 Sep 2013 20:57:13 +0000 (13:57 -0700)
committerKaiwei Fan <fank@vmware.com>
Fri, 6 Sep 2013 22:24:42 +0000 (15:24 -0700)
commitfc0e7cd5ab01cb54ba7f2696e15c49e1fb827bc7
treea0047ba3729afc79a844c1d00a0cd97ec631bc0f
parente82f0eb5df898f930f6d6a476b5d9550b1625d76
Fix IF checks on spawned green thread instance

Initially the symptom looks like race condition between two threads when
stopping the task manager. After further analysis/troubleshooting, it
turns out that two threads are spawned if a task manager is stopped and
started again, causing unexpected errors.

The IF check on the spawned thread sometimes return True sometime return False
if not compared against None explicitly. This makes start() method
think no thread has been started or stop() method think no thread is started.
Change the check to compare against None.

Also fixed a problem in unit-test where a thread may never terminated when
a stop call is invoked during db access.

Closes-Bug: 1221486
Change-Id: I0d67bfe8fef7a390f0d6bc0f5a42835f86a9fb27
neutron/plugins/nicira/vshield/tasks/tasks.py
neutron/tests/unit/nicira/test_vcns_driver.py