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.
Reviewed: https:/ /review. openstack. org/45362 github. com/openstack/ neutron/ commit/ fc0e7cd5ab01cb5 4ba7f2696e15c49 e1fb827bc7
Committed: http://
Submitter: Jenkins
Branch: master
commit fc0e7cd5ab01cb5 4ba7f2696e15c49 e1fb827bc7
Author: Kaiwei Fan <email address hidden>
Date: Thu Sep 5 13:57:13 2013 -0700
Fix IF checks on spawned green thread instance
Initially the symptom looks like race condition between two threads when troubleshooting , it
stopping the task manager. After further analysis/
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 90f0d6bc0f5a428 35f86a9fb27
Change-Id: I0d67bfe8fef7a3