[issue29519] weakref spewing exceptions during finalization when combined with multiprocessing

Łukasz Langa report at bugs.python.org
Thu Feb 9 23:35:06 EST 2017


New submission from Łukasz Langa:

Antoine, #28427 introduces a regression. When used with multiprocessing, the WeakValueDictionary in `multiprocessing.util._afterfork_registry` causes the `remove()` to be invoked during `atexit` and then `sys.meta_path` is None, lots of things is None, including the global `_remove_dead_weakref`.

In effect, I'm getting spew like this:

Exception ignored in: <function WeakValueDictionary.__init__.<locals>.remove at 0x7fb2b905e2f0>
Traceback (most recent call last):
  File "/usr/local/fbcode/gcc-4.9-glibc-2.20-fb/lib/python3.6/weakref.py", line 112, in remove
TypeError: 'NoneType' object is not callable
Exception ignored in: <function WeakValueDictionary.__init__.<locals>.remove at 0x7fb2b905e2f0>
Traceback (most recent call last):
  File "/usr/local/fbcode/gcc-4.9-glibc-2.20-fb/lib/python3.6/weakref.py", line 112, in remove
TypeError: 'NoneType' object is not callable
Exception ignored in: <function WeakValueDictionary.__init__.<locals>.remove at 0x7fb2b905e2f0>
Traceback (most recent call last):
  File "/usr/local/fbcode/gcc-4.9-glibc-2.20-fb/lib/python3.6/weakref.py", line 112, in remove
TypeError: 'NoneType' object is not callable
Exception ignored in: <function WeakValueDictionary.__init__.<locals>.remove at 0x7fb2b905e2f0>
Traceback (most recent call last):
  File "/usr/local/fbcode/gcc-4.9-glibc-2.20-fb/lib/python3.6/weakref.py", line 112, in remove
TypeError: 'NoneType' object is not callable

When debugged, this 'NoneType' is `_remove_dead_weakref` (weakref.py:117).

I'm working on a smaller repro, unfortunately this happens as part of a rather large multiprocessing app so this might take a while. Just wanted to let you know, maybe you'll know right away what the problem is.

----------
assignee: pitrou
components: Library (Lib)
keywords: 3.5regression, 3.6regression
messages: 287475
nosy: lukasz.langa, pitrou
priority: normal
severity: normal
status: open
title: weakref spewing exceptions during finalization when combined with multiprocessing
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29519>
_______________________________________


More information about the Python-bugs-list mailing list