Commit c154e45a authored by Julien Muchembled's avatar Julien Muchembled

Work around potential deadlock when stopping threaded test

For example, with test2Clusters:

Traceback (most recent call last):
  File "neo/master/app.py", line 111, in run
    self._run()
  File "neo/master/app.py", line 131, in _run
    self.playPrimaryRole()
  File "neo/master/app.py", line 318, in playPrimaryRole
    self.provideService()
  File "neo/master/app.py", line 269, in provideService
    em.poll(1)
  File "neo/lib/event.py", line 90, in poll
    self._poll(timeout=timeout)
  File "neo/tests/threaded/__init__.py", line 150, in _poll
    Serialized.tic(self._lock)
  File "neo/tests/threaded/__init__.py", line 102, in tic
    cls.release(lock); cls.acquire(lock)
  File "neo/tests/threaded/__init__.py", line 88, in acquire
    elif threading.currentThread() in cls.pending:
TypeError: argument of type 'int' is not iterable
parent b80fc0c4
...@@ -82,10 +82,11 @@ class Serialized(object): ...@@ -82,10 +82,11 @@ class Serialized(object):
if lock is None: if lock is None:
lock = cls._global_lock lock = cls._global_lock
lock.acquire() lock.acquire()
if type(cls.pending) is frozenset: # XXX pending = cls.pending # XXX: getattr once to avoid race conditions
if type(pending) is frozenset: # XXX
if lock is cls._global_lock: if lock is cls._global_lock:
cls.pending = 0 cls.pending = 0
elif threading.currentThread() in cls.pending: elif threading.currentThread() in pending:
sys.exit() sys.exit()
if cls._pdb: if cls._pdb:
cls._pdb = False cls._pdb = False
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment