[New-bugs-announce] [issue10158] BadInternalCall running test_multiprocessing
report at bugs.python.org
Wed Oct 20 22:54:22 CEST 2010
New submission from Bob Halley <halley at dnspython.org>:
For reasons not germane to this bug report, I was running a modified Python 2.7 where PyTrash_UNWIND_LEVEL in Include/object.h had been defined to 10 instead of 50.
With such a python, running test_multiprocessing causes a BadInternalCall to be triggered at line 903 of weakrefobject.c.
test_finalize (__main__.WithProcessesTestFinalize) ... Process Process-18:
Traceback (most recent call last):
File "/Users/halley/src/release27-maint/Lib/multiprocessing/process.py", line 229, in _bootstrap
File "/Users/halley/src/release27-maint/Lib/multiprocessing/util.py", line 125, in _run_after_forkers
items = list(_afterfork_registry.items())
File "/Users/halley/src/release27-maint/Lib/weakref.py", line 116, in items
for key, wr in self.data.items():
SystemError: Objects/weakrefobject.c:903: bad argument to internal function
I'm running the head of the release27-maint branch, but the problem occurs with the released 2.7 too.
The trigger for the error is that object->ob_refcount is 1.
I stuck an abort() into the code just before the BadInternalCall, and looked at the core. The ob_type is a Semaphore, and the last bit of the call chain is:
#0 0x00007fff8791c3d6 in __kill ()
#1 0x00007fff879bc972 in abort ()
#2 0x000000010007eb05 in PyObject_ClearWeakRefs (object=<value temporarily unavailable, due to optimizations>) at Objects/weakrefobject.c:903
#3 0x000000010006c949 in subtype_dealloc (self=0x10070a150) at Objects/typeobject.c:952
#4 0x000000010005341b in _PyTrash_destroy_chain () at Objects/object.c:2435
#5 0x000000010003bfaf in listiter_next (it=0x1006db8d0) at Objects/listobject.c:2917
#6 0x00000001000b9f16 in PyEval_EvalFrameEx (f=0x1013b91a0, throwflag=<value temporarily unavailable, due to optimizations>) at Python/ceval.c:2496
#7 0x00000001000c0966 in PyEval_EvalFrameEx (f=0x1013bcc40, throwflag=<value temporarily unavailable, due to optimizations>) at Python/ceval.c:4098
#8 0x00000001000c0966 in PyEval_EvalFrameEx (f=0x10137a500, throwflag=<value temporarily unavailable, due to optimizations>) at Python/ceval.c:4098
#9 0x00000001000c0966 in PyEval_EvalFrameEx (f=0x101374aa0, throwflag=<value temporarily unavailable, due to optimizations>) at Python/ceval.c:4098
#10 0x00000001000c1826 in PyEval_EvalCodeEx (co=0x10065d1b0, globals=<value temporarily unavailable, due to optimizations>, locals=<value temporarily unavailable, due to optimizations>, args=0x100708458, argcount=2, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:3252
#11 0x0000000100037580 in function_call (func=0x100678488, arg=0x100708440, kw=0x0) at Objects/funcobject.c:526
#12 0x00000001000063e2 in PyObject_Call (func=0x100678488, arg=0x100708440, kw=0x0) at Objects/abstract.c:2529
#13 0x00000001000177bd in instancemethod_call (func=0x100678488, arg=0x100708440, kw=0x0) at Objects/classobject.c:2578
#14 0x00000001000063e2 in PyObject_Call (func=0x100704780, arg=0x1006f17d0, kw=0x0) at Objects/abstract.c:2529
#15 0x0000000100071a38 in slot_tp_init (self=<value temporarily unavailable, due to optimizations>, args=0x1006f17d0, kwds=0x0) at Objects/typeobject.c:5651
#16 0x000000010006ee75 in type_call (type=0x10130bd10, args=0x1006f17d0, kwds=0x0) at Objects/typeobject.c:726
#17 0x00000001000063e2 in PyObject_Call (func=0x10130bd10, arg=0x1006f17d0, kw=0x0) at Objects/abstract.c:2529
Note that the trashcan function _PyTrash_destroy_chain() is involved.
I don't understand this code well enough to have figured out what's going wrong yet. I worry that there's some subtle interaction with weakrefs, subtyped objects, and the trashcan, but maybe it's something simpler!
components: Interpreter Core
title: BadInternalCall running test_multiprocessing
versions: Python 2.7
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce