godot-python icon indicating copy to clipboard operation
godot-python copied to clipboard

godot-python gets heap corruption (Windows Application Verifier) error while starting up

Open garyo opened this issue 7 years ago • 0 comments

I had a memory corruption problem in my app, so I tried turning on Application Verifier using Windows gflags (https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/gflags-overview) to see where the corruption was happening. But doing that shows a heap corruption issue (overwriting the end of a block) while starting python from godot.

This is with latest Godot 0f930f831, gdnative d8becfb, and godot-python 6518e25. Using Windows python 3.6.3 and Visual Studio 2015.

Here's a simple test project that shows it: godot-autoload-example.zip

To repro, either use gflags.exe and enable page heap or application verifier for godot.windows.tools.exe, or just set the registry key Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\godot.windows.tools.exe:

 GlobalFlag: dword:0x02000000
 PageHeapFlags: dword:0x3

Here's the error:

===========================================================
VERIFIER STOP 000000000000000F: pid 0x4EC4: corrupted suffix pattern 

	000002E424761000 : Heap handle
	000002E465988FD0 : Heap block
	000000000000002C : Block size
	000002E465988FFC : corruption address
===========================================================

and here's the stack trace:

 	verifier.dll!VerifierCaptureContextAndReportStop()	Unknown
 	verifier.dll!VerifierStopMessage()	Unknown
 	verifier.dll!AVrfpDphReportCorruptedBlock()	Unknown
 	verifier.dll!AVrfpDphCheckPageHeapBlock()	Unknown
 	verifier.dll!AVrfpDphFindBusyMemory()	Unknown
 	verifier.dll!AVrfpDphFindBusyMemoryAndRemoveFromBusyList()	Unknown
 	verifier.dll!AVrfDebugPageHeapFree()	Unknown
 	ntdll.dll!RtlDebugFreeHeap()	Unknown
 	ntdll.dll!RtlpFreeHeap()	Unknown
 	ntdll.dll!RtlFreeHeap()	Unknown
 	ucrtbase.dll!_free_base()	Unknown
 	python36.dll!frame_dealloc(_frame * f) Line 423	C
 	[Inline Frame] python36.dll!_PyFunction_FastCall(PyCodeObject * args, _object * *) Line 4909	C
 	[Inline Frame] python36.dll!fast_function(_object * stack, _object * *) Line 4941	C
 	python36.dll!call_function(_object * * * pp_stack, __int64 oparg, _object * kwnames) Line 4845	C
 	python36.dll!_PyEval_EvalFrameDefault(_frame * f, int throwflag) Line 3324	C
 	[Inline Frame] python36.dll!PyEval_EvalFrameEx(_frame *) Line 753	C
 	python36.dll!_PyEval_EvalCodeWithName(_object * _co, _object * globals, _object * locals, _object * * args, __int64 argcount, _object * * kwnames, _object * * kwargs, __int64 kwcount, int kwstep, _object * * defs, __int64 defcount, _object * kwdefs, _object * closure, _object * name, _object * qualname) Line 4153	C
 	python36.dll!_PyFunction_FastCallDict(_object * func, _object * * args, __int64 nargs, _object * kwargs) Line 5057	C
 	python36.dll!_PyObject_FastCallDict(_object * func, _object * * args, __int64 nargs, _object * kwargs) Line 2311	C
 	python36.dll!partial_call(partialobject * pto, _object * args, _object * kw) Line 183	C
 	[Inline Frame] python36.dll!_PyObject_FastCallDict(_object *) Line 2331	C
 	[Inline Frame] python36.dll!_PyObject_FastCallKeywords(_object *) Line 2496	C
 	python36.dll!call_function(_object * * * pp_stack, __int64 oparg, _object * kwnames) Line 4848	C
 	python36.dll!_PyEval_EvalFrameDefault(_frame * f, int throwflag) Line 3324	C
 	[Inline Frame] python36.dll!PyEval_EvalFrameEx(_frame *) Line 753	C
 	[Inline Frame] python36.dll!_PyFunction_FastCall(PyCodeObject * args, _object * *) Line 4906	C
 	python36.dll!_PyFunction_FastCallDict(_object * func, _object * * args, __int64 nargs, _object * kwargs) Line 5008	C
 	[Inline Frame] python36.dll!_PyObject_FastCallDict(_object *) Line 2310	C
 	[Inline Frame] python36.dll!_PyObject_Call_Prepend(_object *) Line 2373	C
 	python36.dll!method_call(_object * method, _object * args, _object * kwargs) Line 317	C
 	[Inline Frame] python36.dll!_PyObject_FastCallDict(_object * func, _object * *) Line 2331	C
 	python36.dll!PyObject_CallFunctionObjArgs(_object * callable, ...) Line 2827	C
 	python36.dll!call_attribute(_object * self, _object * attr, _object * name) Line 6230	C
 	python36.dll!slot_tp_getattr_hook(_object * self, _object * name) Line 6272	C
 	[Inline Frame] python36.dll!PyObject_GetAttr(_object * v, _object *) Line 891	C
 	python36.dll!builtin_getattr(_object * self, _object * args) Line 1017	C
 	python36.dll!_PyCFunction_FastCallDict(_object * func_obj, _object * * args, __int64 nargs, _object * kwargs) Line 236	C
 	[Inline Frame] python36.dll!_PyCFunction_FastCallKeywords(_object *) Line 294	C
 	python36.dll!call_function(_object * * * pp_stack, __int64 oparg, _object * kwnames) Line 4824	C
 	python36.dll!_PyEval_EvalFrameDefault(_frame * f, int throwflag) Line 3324	C
 	[Inline Frame] python36.dll!PyEval_EvalFrameEx(_frame *) Line 753	C
 	[Inline Frame] python36.dll!_PyFunction_FastCall(PyCodeObject * args, _object * *) Line 4906	C
 	python36.dll!_PyFunction_FastCallDict(_object * func, _object * * args, __int64 nargs, _object * kwargs) Line 5008	C
 	python36.dll!_PyObject_FastCallDict(_object * func, _object * * args, __int64 nargs, _object * kwargs) Line 2311	C
 	python36.dll!partial_call(partialobject * pto, _object * args, _object * kw) Line 183	C
 	[Inline Frame] python36.dll!_PyObject_FastCallDict(_object *) Line 2331	C
 	[Inline Frame] python36.dll!_PyObject_FastCallKeywords(_object *) Line 2496	C
 	python36.dll!call_function(_object * * * pp_stack, __int64 oparg, _object * kwnames) Line 4848	C
 	python36.dll!_PyEval_EvalFrameDefault(_frame * f, int throwflag) Line 3324	C
 	[Inline Frame] python36.dll!PyEval_EvalFrameEx(_frame *) Line 753	C
 	[Inline Frame] python36.dll!_PyFunction_FastCall(PyCodeObject * args, _object * *) Line 4906	C
 	python36.dll!_PyFunction_FastCallDict(_object * func, _object * * args, __int64 nargs, _object * kwargs) Line 5008	C
 	[Inline Frame] python36.dll!_PyObject_FastCallDict(_object *) Line 2310	C
 	[Inline Frame] python36.dll!_PyObject_Call_Prepend(_object *) Line 2373	C
 	python36.dll!method_call(_object * method, _object * args, _object * kwargs) Line 317	C
 	[Inline Frame] python36.dll!_PyObject_FastCallDict(_object * func, _object * *) Line 2331	C
 	python36.dll!PyObject_CallFunctionObjArgs(_object * callable, ...) Line 2827	C
 	python36.dll!call_attribute(_object * self, _object * attr, _object * name) Line 6230	C
 	python36.dll!slot_tp_getattr_hook(_object * self, _object * name) Line 6272	C
 	python36.dll!PyObject_GetAttr(_object * v, _object * name) Line 902	C
 	python36.dll!import_from(_object * v, _object * name) Line 5246	C
 	python36.dll!_PyEval_EvalFrameDefault(_frame * f, int throwflag) Line 2923	C
 	[Inline Frame] python36.dll!PyEval_EvalFrameEx(_frame *) Line 753	C
 	python36.dll!_PyEval_EvalCodeWithName(_object * _co, _object * globals, _object * locals, _object * * args, __int64 argcount, _object * * kwnames, _object * * kwargs, __int64 kwcount, int kwstep, _object * * defs, __int64 defcount, _object * kwdefs, _object * closure, _object * name, _object * qualname) Line 4153	C
 	[Inline Frame] python36.dll!PyEval_EvalCodeEx(_object *) Line 4174	C
 	[Inline Frame] python36.dll!PyEval_EvalCode(_object *) Line 730	C
 	python36.dll!builtin_exec_impl(_object * source, _object * globals, _object * locals, _object *) Line 976	C
 	python36.dll!builtin_exec(_object * module, _object * args) Line 283	C
 	python36.dll!_PyEval_EvalFrameDefault(_frame * f, int throwflag) Line 3391	C
 	[Inline Frame] python36.dll!PyEval_EvalFrameEx(_frame *) Line 753	C
 	python36.dll!_PyEval_EvalCodeWithName(_object * _co, _object * globals, _object * locals, _object * * args, __int64 argcount, _object * * kwnames, _object * * kwargs, __int64 kwcount, int kwstep, _object * * defs, __int64 defcount, _object * kwdefs, _object * closure, _object * name, _object * qualname) Line 4153	C
 	[Inline Frame] python36.dll!fast_function(_object * stack, _object * *) Line 4965	C
 	python36.dll!call_function(_object * * * pp_stack, __int64 oparg, _object * kwnames) Line 4845	C
 	python36.dll!_PyEval_EvalFrameDefault(_frame * f, int throwflag) Line 3324	C
 	[Inline Frame] python36.dll!PyEval_EvalFrameEx(_frame *) Line 753	C
 	[Inline Frame] python36.dll!_PyFunction_FastCall(PyCodeObject * args, _object * *) Line 4906	C
 	[Inline Frame] python36.dll!fast_function(_object * stack, _object * *) Line 4941	C
 	python36.dll!call_function(_object * * * pp_stack, __int64 oparg, _object * kwnames) Line 4845	C
 	python36.dll!_PyEval_EvalFrameDefault(_frame * f, int throwflag) Line 3324	C
 	[Inline Frame] python36.dll!PyEval_EvalFrameEx(_frame *) Line 753	C
 	[Inline Frame] python36.dll!_PyFunction_FastCall(PyCodeObject * args, _object * *) Line 4906	C
 	[Inline Frame] python36.dll!fast_function(_object * stack, _object * *) Line 4941	C
 	python36.dll!call_function(_object * * * pp_stack, __int64 oparg, _object * kwnames) Line 4845	C
 	python36.dll!_PyEval_EvalFrameDefault(_frame * f, int throwflag) Line 3324	C
 	[Inline Frame] python36.dll!PyEval_EvalFrameEx(_frame *) Line 753	C
 	[Inline Frame] python36.dll!_PyFunction_FastCall(PyCodeObject * args, _object * *) Line 4906	C
 	[Inline Frame] python36.dll!fast_function(_object * stack, _object * *) Line 4941	C
 	python36.dll!call_function(_object * * * pp_stack, __int64 oparg, _object * kwnames) Line 4845	C
 	python36.dll!_PyEval_EvalFrameDefault(_frame * f, int throwflag) Line 3324	C
 	[Inline Frame] python36.dll!PyEval_EvalFrameEx(_frame *) Line 753	C
 	[Inline Frame] python36.dll!_PyFunction_FastCall(PyCodeObject * args, _object * *) Line 4906	C
 	python36.dll!_PyFunction_FastCallDict(_object * func, _object * * args, __int64 nargs, _object * kwargs) Line 5008	C
 	python36.dll!_PyObject_FastCallDict(_object * func, _object * * args, __int64 nargs, _object * kwargs) Line 2311	C
 	python36.dll!_PyObject_CallMethodIdObjArgs(_object * callable, _Py_Identifier * name, ...) Line 2797	C
 	python36.dll!PyImport_ImportModuleLevelObject(_object * name, _object * globals, _object * locals, _object * fromlist, int level) Line 1566	C
 	python36.dll!_PyEval_EvalFrameDefault(_frame * f, int throwflag) Line 2886	C
 	[Inline Frame] python36.dll!PyEval_EvalFrameEx(_frame *) Line 753	C
 	python36.dll!_PyEval_EvalCodeWithName(_object * _co, _object * globals, _object * locals, _object * * args, __int64 argcount, _object * * kwnames, _object * * kwargs, __int64 kwcount, int kwstep, _object * * defs, __int64 defcount, _object * kwdefs, _object * closure, _object * name, _object * qualname) Line 4153	C
 	[Inline Frame] python36.dll!PyEval_EvalCodeEx(_object *) Line 4174	C
 	[Inline Frame] python36.dll!PyEval_EvalCode(_object *) Line 730	C
 	python36.dll!builtin_exec_impl(_object * source, _object * globals, _object * locals, _object *) Line 976	C
 	python36.dll!builtin_exec(_object * module, _object * args) Line 283	C
 	python36.dll!_PyEval_EvalFrameDefault(_frame * f, int throwflag) Line 3391	C
 	[Inline Frame] python36.dll!PyEval_EvalFrameEx(_frame *) Line 753	C
 	python36.dll!_PyEval_EvalCodeWithName(_object * _co, _object * globals, _object * locals, _object * * args, __int64 argcount, _object * * kwnames, _object * * kwargs, __int64 kwcount, int kwstep, _object * * defs, __int64 defcount, _object * kwdefs, _object * closure, _object * name, _object * qualname) Line 4153	C
 	[Inline Frame] python36.dll!fast_function(_object * stack, _object * *) Line 4965	C
 	python36.dll!call_function(_object * * * pp_stack, __int64 oparg, _object * kwnames) Line 4845	C
 	python36.dll!_PyEval_EvalFrameDefault(_frame * f, int throwflag) Line 3324	C
 	[Inline Frame] python36.dll!PyEval_EvalFrameEx(_frame *) Line 753	C
 	[Inline Frame] python36.dll!_PyFunction_FastCall(PyCodeObject * args, _object * *) Line 4906	C
 	[Inline Frame] python36.dll!fast_function(_object * stack, _object * *) Line 4941	C
 	python36.dll!call_function(_object * * * pp_stack, __int64 oparg, _object * kwnames) Line 4845	C
 	python36.dll!_PyEval_EvalFrameDefault(_frame * f, int throwflag) Line 3324	C
 	[Inline Frame] python36.dll!PyEval_EvalFrameEx(_frame *) Line 753	C
 	[Inline Frame] python36.dll!_PyFunction_FastCall(PyCodeObject * args, _object * *) Line 4906	C
 	[Inline Frame] python36.dll!fast_function(_object * stack, _object * *) Line 4941	C
 	python36.dll!call_function(_object * * * pp_stack, __int64 oparg, _object * kwnames) Line 4845	C
 	python36.dll!_PyEval_EvalFrameDefault(_frame * f, int throwflag) Line 3324	C
 	[Inline Frame] python36.dll!PyEval_EvalFrameEx(_frame *) Line 753	C
 	[Inline Frame] python36.dll!_PyFunction_FastCall(PyCodeObject * args, _object * *) Line 4906	C
 	[Inline Frame] python36.dll!fast_function(_object * stack, _object * *) Line 4941	C
 	python36.dll!call_function(_object * * * pp_stack, __int64 oparg, _object * kwnames) Line 4845	C
 	python36.dll!_PyEval_EvalFrameDefault(_frame * f, int throwflag) Line 3324	C
 	[Inline Frame] python36.dll!PyEval_EvalFrameEx(_frame *) Line 753	C
 	[Inline Frame] python36.dll!_PyFunction_FastCall(PyCodeObject * args, _object * *) Line 4906	C
 	python36.dll!_PyFunction_FastCallDict(_object * func, _object * * args, __int64 nargs, _object * kwargs) Line 5008	C
 	python36.dll!_PyObject_FastCallDict(_object * func, _object * * args, __int64 nargs, _object * kwargs) Line 2311	C
 	python36.dll!_PyObject_CallMethodIdObjArgs(_object * callable, _Py_Identifier * name, ...) Line 2797	C
 	python36.dll!PyImport_ImportModuleLevelObject(_object * name, _object * globals, _object * locals, _object * fromlist, int level) Line 1566	C
 	python36.dll!_PyEval_EvalFrameDefault(_frame * f, int throwflag) Line 2886	C
 	[Inline Frame] python36.dll!PyEval_EvalFrameEx(_frame *) Line 753	C
 	python36.dll!_PyEval_EvalCodeWithName(_object * _co, _object * globals, _object * locals, _object * * args, __int64 argcount, _object * * kwnames, _object * * kwargs, __int64 kwcount, int kwstep, _object * * defs, __int64 defcount, _object * kwdefs, _object * closure, _object * name, _object * qualname) Line 4153	C
 	python36.dll!PyEval_EvalCodeEx(_object * _co, _object * globals, _object * locals, _object * * args, int argcount, _object * * kws, int kwcount, _object * * defs, int defcount, _object * kwdefs, _object * closure) Line 4181	C
 	python36.dll!PyEval_EvalCode(_object * co, _object * globals, _object * locals) Line 736	C
 	pythonscript.dll!00007ffba3281bf8()	Unknown
 	pythonscript.dll!00007ffba3282294()	Unknown
 	pythonscript.dll!00007ffba3281668()	Unknown
 	pythonscript.dll!00007ffba328236f()	Unknown
>	godot.windows.tools.exe!PluginScriptLanguage::init() Line 44	C++
 	godot.windows.tools.exe!ScriptServer::init_languages() Line 108	C++
 	godot.windows.tools.exe!Main::setup2(unsigned __int64 p_main_tid_override) Line 1209	C++
 	godot.windows.tools.exe!Main::setup(const char * execpath, int argc, char * * argv, bool p_second_phase) Line 986	C++
 	godot.windows.tools.exe!widechar_main(int argc, wchar_t * * argv) Line 138	C++
 	godot.windows.tools.exe!_main() Line 172	C++
 	godot.windows.tools.exe!main(int _argc, char * * _argv) Line 184	C++
 	[Inline Frame] godot.windows.tools.exe!invoke_main() Line 78	C++
 	godot.windows.tools.exe!__scrt_common_main_seh() Line 283	C++
 	kernel32.dll!BaseThreadInitThunk()	Unknown
 	ntdll.dll!RtlUserThreadStart()	Unknown

garyo avatar May 10 '18 14:05 garyo