You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Access violation in python39.dll!meth_dealloc on exit #85409
When testing extension packages on Python 3.9.0b4 for Windows, I often get access violations in python39.dll!meth_dealloc during interpreter exit. The crash only happens when heap verification is turned on ("C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\gflags.exe" /p /enable python.exe; https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/gflags). The debug build does not crash.
> python39.dll!meth_dealloc(PyCFunctionObject * m) Line 169 C
[Inline Frame] python39.dll!_Py_Dealloc(_object *) Line 2209 C
[Inline Frame] python39.dll!_Py_DECREF(_object *) Line 430 C
[Inline Frame] python39.dll!_Py_XDECREF(_object * op) Line 497 C
[Inline Frame] python39.dll!free_keys_object(_dictkeysobject *) Line 598 C
[Inline Frame] python39.dll!dictkeys_decref(_dictkeysobject *) Line 333 C
python39.dll!dict_dealloc(PyDictObject * mp) Line 2026 C
[Inline Frame] python39.dll!_Py_Dealloc(_object *) Line 2209 C
[Inline Frame] python39.dll!_Py_DECREF(_object *) Line 430 C
python39.dll!_PyInterpreterState_ClearModules(_is * interp) Line 768 C
python39.dll!_PyImport_Cleanup(_ts * tstate) Line 628 C
python39.dll!Py_FinalizeEx() Line 1432 C
python39.dll!Py_Exit(int sts) Line 2433 C
python39.dll!handle_system_exit() Line 696 C
python39.dll!_PyErr_PrintEx(_ts * tstate, int set_sys_last_vars) Line 708 C
[Inline Frame] python39.dll!PyErr_Print() Line 807 C
python39.dll!PyRun_InteractiveLoopFlags(_iobuf * fp, const char * filename_str, PyCompilerFlags * flags) Line 137 C
python39.dll!PyRun_AnyFileExFlags(_iobuf * fp, const char * filename, int closeit, PyCompilerFlags * flags) Line 81 C
python39.dll!pymain_run_stdin(PyConfig * config, PyCompilerFlags * cf) Line 509 C
python39.dll!pymain_run_python(int * exitcode) Line 597 C
python39.dll!Py_RunMain() Line 675 C
python39.dll!Py_Main(int argc, wchar_t * * argv) Line 716 C
[External Code]
I tracked this to an import of the numba-0.50.1 package during the numpy tests. python -c"import numba' is enough to reproduce this crash during interpreter exit. Probably the package needs to be ported to Python 3.9.
This issue seems specific to C extensions built with pybind11 (using 2.5.0 and master branch). Building the minimal example at https://github.com/pybind/python_example and running python.exe -c"import python_example" will crash at exit.
Activity
cgohlke commentedon Jul 8, 2020
When testing extension packages on Python 3.9.0b4 for Windows, I often get access violations in
python39.dll!meth_deallocduring interpreter exit. The crash only happens when heap verification is turned on ("C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\gflags.exe" /p /enable python.exe; https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/gflags). The debug build does not crash.Could be related to "PEP-573: Module State Access from C Extension Methods", https://bugs.python.org/issue38787
To reproduce the crash with with numpy-1.19.0 (built from source):
The crash is at <https://github.com/python/cpython/blob/1d1c5743400bdf384ec83eb6ba5b39a355d121e3/Objects/methodobject.c#L169\>:
Call Stack:
Locals:
cgohlke commentedon Jul 8, 2020
I tracked this to an import of the numba-0.50.1 package during the numpy tests.
python -c"import numba'is enough to reproduce this crash during interpreter exit. Probably the package needs to be ported to Python 3.9.cgohlke commentedon Jul 9, 2020
This issue seems specific to C extensions built with pybind11 (using 2.5.0 and master branch). Building the minimal example at https://github.com/pybind/python_example and running
python.exe -c"import python_example"will crash at exit.