[Bug 1850289] Re: Testcases hangs : /usr/local/lib/python3.7/threading.py", line 1335, in _after_fork

Brian Murray brian at ubuntu.com
Wed Oct 30 16:05:36 UTC 2019


** Project changed: python-launchpad-bugs => python3.7 (Ubuntu)

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python3.7 in Ubuntu.
https://bugs.launchpad.net/bugs/1850289

Title:
  Testcases hangs : /usr/local/lib/python3.7/threading.py", line 1335,
  in _after_fork

Status in python3.7 package in Ubuntu:
  New

Bug description:
  When py3.7 test is executed for nova-powervm, it hangs and gets
  timed_out. the same testcases executes fine in py3.6 env.

  below exception occurs and doesnt exit from the tests.
   
  Exception ignored in: <function _after_fork at 0x7fe220046e18>
  Traceback (most recent call last):
    File "/usr/local/lib/python3.7/threading.py", line 1335, in _after_fork
      assert len(_active) == 1
  AssertionError:
  Exception ignored in: <function _after_fork at 0x7f40f5346e18>
  Traceback (most recent call last):
    File "/usr/local/lib/python3.7/threading.py", line 1335, in _after_fork
      assert len(_active) == 1
  AssertionError:
  Exception ignored in: <function _after_fork at 0x7f2795418e18>
  Traceback (most recent call last):
    File "/usr/local/lib/python3.7/threading.py", line 1335, in _after_fork
      assert len(_active) == 1
  AssertionError:
  Exception ignored in: <function _after_fork at 0x7ff2e7d26e18>
  Traceback (most recent call last):
    File "/usr/local/lib/python3.7/threading.py", line 1335, in _after_fork
      assert len(_active) == 1
  AssertionError:
  Exception ignored in: <function _after_fork at 0x7f17debb7e18>
  Traceback (most recent call last):
    File "/usr/local/lib/python3.7/threading.py", line 1335, in _after_fork
      assert len(_active) == 1
  AssertionError:

  
  ``````````````````````````````````````````````````````````````````````````````

  def _after_fork():
      """
      Cleanup threading module state that should not exist after a fork.
      """
      # Reset _active_limbo_lock, in case we forked while the lock was held
      # by another (non-forked) thread.  http://bugs.python.org/issue874900
      global _active_limbo_lock, _main_thread
      _active_limbo_lock = _allocate_lock()

      # fork() only copied the current thread; clear references to others.
      new_active = {}
      current = current_thread()
      _main_thread = current
      with _active_limbo_lock:
          # Dangling thread instances must still have their locks reset,
          # because someone may join() them.
          threads = set(_enumerate())
          threads.update(_dangling)
          for thread in threads:
              # Any lock/condition variable may be currently locked or in an
              # invalid state, so we reinitialize them.
              if thread is current:
                  # There is only one active thread. We reset the ident to
                  # its new value since it can have changed.
                  thread._reset_internal_locks(True)
                  ident = get_ident()
                  thread._ident = ident
                  new_active[ident] = thread
              else:
                  # All the others are already stopped.
                  thread._reset_internal_locks(False)
                  thread._stop()

          _limbo.clear()
          _active.clear()
          _active.update(new_active)
          assert len(_active) == 1

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python3.7/+bug/1850289/+subscriptions



More information about the foundations-bugs mailing list