Problem
This application has requested the Runtime to terminate it in an
unusual way.
If you ever receive this error while running a windows application, it is most possibly because somewhere in your python library, and even possible from your python runtime, abort()
routine was called. For more information, and the behaviour of calling abort
please refer the MSDN documentation on abort
Demo
You would need
- Visual Studio 2008 (Express Edition)
- Setting the Microsoft Symbol Server correctly in _SYM_PATH
- Python 2.7
- Install WinDBG, and set it up as JIT
Create a C DLL which calls abort()
and then call this DLL using ctypes
Header File abort_dll.h
#include<cstdlib>
#include <windows.h>
extern "C" __declspec(dllexport) void call_abort(void);
Source abort_dll.cpp
#include "abort_dll.h"
__declspec(dllexport) void call_abort(void)
{
abort();
}
Source dllmain.cpp
#include "abort_dll.h"
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
Now Compile and Build Your DLL (both in Debug and Release Version).
Assuming my DLLs are present in the following location
Debug Version: C:\TEMP\Debug\abort_dll.dll
Release Version: C:\TEMP\Release\abort_dll.dll
Execute the following code in your IDLE
from ctypes import *
hDLL = WinDLL(r"C:\TEMP\Debug\abort_dll.dll")
hDLL.call_abort()
You are sure to see the following Popup
The only difference with your case is, it gives you the infamous option [Abort|Retry\Ignore]. It was only because I had used a Debug version of my DLL. Instead, if I had used a release version, I would typically see
Solution
In Windows, AFAIK you cannot handle the SIGABRT
with a signal handler. So, the only bet is to use the JIT, that I suppose you had already installed. you would then see the following pop up.
If you would select Debug, that will open your installed JIT debugger. After which, you can dump the failing stack, and determine the failing module. Once done, you can then correlate what could be the python module that might have called the module.