Python program crashes because of ntdll.dll and QtGui4.dll

I have designed a Python software to collect data from my microcontroller and make live plots:

I have twelve matplotlib animations in my GUI (the GUI is designed with PyQt). Each matplotlib animation is connected to one TCP thread, receiving floating point numbers through that link. Upon receiving a floating point number, the matplotlib animation adds a new point to the graph. And huray, we got live plots!

My software runs smoothly for a couple of seconds (sometimes up to half a minute). And then disaster strikes. Windows mentions "Python has stopped working". I don't even get an exception report printed in my terminal window (as it normally would happen for all my other bugs). Windows asks me if I want to debug the Python application, and suggests to use Visual Basic for that. In Visual Basic, I get the following error report:

Unhandled exception at 0x00007FFC596CE6FC (ntdll.dll) in
python.exe: 0xC0000374: A heap has been corrupted
(parameters: 0x00007FFC597222B0).

Unhandled exception at 0x00007FFC56071F28 in python.exe:
Microsoft C++ exception: std::bad_alloc at memory
location 0x0000003DBA30E8F0.

Exception thrown at 0x0000000000000000 in python.exe:
0xC0000005: Access violation executing location

I restart everything, and try it once more. Disaster strikes again, and I get the following error report in Visual Basic:

Unhandled exception at 0x00000000660E8D61 (QtGui4.dll) in python.exe:
0xC0000005: Access violation reading location 0x0000000000000020.

Once again, I restart for another trial. Disaster hits me again:

Unhandled exception at 0x00007FFC596CE6FC (ntdll.dll) in python.exe:
0xC0000374: A heap has been corrupted (parameters: 0x00007FFC597222B0).

Unfortunately, I have no clue what these error reports mean. I have googled QtGui4.dlland ntdll.dll. I found a couple of programs to fix dll's on my computer, but Norton antivirus tells me that I cannot trust them. So I'm out of options now, and turn to StackOverflow as my last resort.

Thanks in advance for your help.

EDIT : I have followed your advice to change the matplotlib backend through matplotlib.use("Qt4Agg"), but it didn't help.


I believe that the issue is fixed now. This was the root cause of the problem. I accessed my GUI (for example the live plots, the LEDs, ..) from another thread, in a thread-unsafe way. The application works good for some time (half a minute), but inevitably crashes miserably later on.

I fixed it through using the signal/slot mechanism. This is how (a link to another StackOverflow question):

Simplest way for PyQT Threading

I'm sorry for the inconvenience.

受限制的 HTML

  • 允许的HTML标签:<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • 自动断行和分段。
  • 网页和电子邮件地址自动转换为链接。

  • 使用 symstore.exe 无法在 Windbg 或 Visual Studio 中加载用于小型转储的符号(Using symstore.exe cannot load symbols for minidump in Windbg or Visual Studio)
    问题 为了跟踪仅在 Windows 8 用户计算机上发生的 Qt 中的崩溃,我设置了一个本地符号服务器以用于调试崩溃转储。 首先,我使用以下标志集进行了完整构建: QMAKE_CFLAGS_RELEASE += -Zi QMAKE_CXXFLAGS_RELEASE += -Zi QMAKE_LFLAGS_RELEASE += /DEBUG /OPT:REF 并使用 Windows Installer 和 VS 部署项目构建了一个安装程序。 然后我运行了以下 symstore.exe 命令: C:\Program Files (x86)\Windows Kits\8.1\Debuggers\x64>symstore.exe add /r /f C:\builddir\*.* /s "C:\Users\Sam\symbols" /t "Application" /v "rev xxxx" /c "test add" 这在C:\Users\Sam\symbols创建了适当的 dll、exe 和 pdb 文件夹。 然后我在用户机器上安装并通过 Process Explorer 生成了一个 minidump 文件。 我尝试将转储加载到 Visual Studio 并将C:\Users\Sam\symbols到符号文件位置,但找不到与我的二进制文件匹配的符号。 然后我尝试将它加载到
  • iTunes 共享库中 PyObject_Call() 的分段错误(Segmentation-fault with PyObject_Call() in shared library for iTunes)
    问题 我正在试验 iTunes SDK 和 Cython。 DLL 入口点似乎有效,但使用任何“真正的 Python”都会导致 iTunes 崩溃。 以下代码编译良好,iTunes 成功加载了 plugin-dll。 cimport libc.stdio as stdio cdef extern from "iTunesAPI/iTunesAPI.h": ctypedef int OSType ctypedef int OSStatus ctypedef struct PluginMessageInfo: pass int unimpErr cdef public OSStatus iTunesPluginMain( OSType message, PluginMessageInfo* messageInfo, void* refCon ): cdef stdio.FILE* fl = stdio.fopen('C:/itunes_cyplugin_feedback.txt', 'wb') return unimpErr 但是添加 Python 表达式会导致 iTunes 崩溃,例如: # ... cdef public OSStatus iTunesPluginMain( OSType message, PluginMessageInfo* messageInfo, void*
  • Segmentation-fault with PyObject_Call() in shared library for iTunes
    I'm experimenting with the iTunes SDK and Cython. The DLL entry-point seems to work, but using any "real Python" causes iTunes to crash. The following code compiles fine and the plugin-dll is loaded successfully by iTunes. cimport libc.stdio as stdio cdef extern from "iTunesAPI/iTunesAPI.h": ctypedef int OSType ctypedef int OSStatus ctypedef struct PluginMessageInfo: pass int unimpErr cdef public OSStatus iTunesPluginMain( OSType message, PluginMessageInfo* messageInfo, void* refCon ): cdef stdio.FILE* fl = stdio.fopen('C:/itunes_cyplugin_feedback.txt', 'wb') return unimpErr But adding a
  • Using symstore.exe cannot load symbols for minidump in Windbg or Visual Studio
    In order to trace a crash in a Qt which only happens on a Windows 8 user machine I set up a local symbol server to use for debugging crash dumps. First I did a full build with the following flags set: QMAKE_CFLAGS_RELEASE += -Zi QMAKE_CXXFLAGS_RELEASE += -Zi QMAKE_LFLAGS_RELEASE += /DEBUG /OPT:REF and built an installer using Windows Installer and a VS deployment project. Then I ran the following symstore.exe command: C:\Program Files (x86)\Windows Kits\8.1\Debuggers\x64>symstore.exe add /r /f C:\builddir\*.* /s "C:\Users\Sam\symbols" /t "Application" /v "rev xxxx" /c "test add" This created
  • 无法导入PyQt4.QtGui(Cannot import PyQt4.QtGui)
    问题 我安装了可正常运行的python 2.6,并且刚刚安装了为python 2.6构建的PyQt4(可从http://www.riverbankcomputing.co.uk/software/pyqt/download下载)。 当我尝试导入PyQt4.QtGui时,出现以下错误: ImportError: DLL load failed: The specified procedure could not be found. 我使用的是Windows 2k8 64位,但是我的Python安装是32位。 回答1 将包含Qt的应用程序和DLL的PyQt4目录添加到PATH环境变量中。 在PowerShell中,只要您不更改任何安装路径,就可以 $env:path += ';C:\Python26\Lib\site-packages\PyQt4\bin' 回答2 我在另一个对我有用的论坛上找到了解决方案。 我需要将QtGui4.dll和QtCore4.dll复制到... \ Python2.7.1 \ Lib \ site-packages \ PyQt4目录中。 注意,我将原始文件保留在bin目录中。 回答3 我已经从.whl文件(从非官方的Windows二进制文件)安装了PyQt4,并遇到了相同的错误。 我做了回答的建议:检查是否安装了正确的版本
  • Java Randomly Crashing (Possible Culprite: ntdll.dll?)
    I have a program that I've written in Java and have set up with Windows Task Scheduler to run every 5 minutes. It executes "C:\Program Files\Java\jre7\bin\javaw.exe" and passes along the jar file and all of the command-line parameters. For the most part, this runs perfectly fine, but every now and then, I would come back to my computer and see a popup saying that "Java(TM) Platform SE binary has stopped working". So, at first, I thought it was something to do with my code, and added in a lot of debug statements which were appended to a text file. When it crashed, I checked the text file and
  • Java 随机崩溃(可能的罪魁祸首:ntdll.dll?)(Java Randomly Crashing (Possible Culprite: ntdll.dll?))
    问题 我有一个用 Java 编写的程序,并使用 Windows 任务计划程序设置为每 5 分钟运行一次。 它执行“C:\Program Files\Java\jre7\bin\javaw.exe”并传递 jar 文件和所有命令行参数。 在大多数情况下,这运行得非常好,但时不时地,我会回到我的计算机并看到一个弹出窗口,说“Java(TM) Platform SE 二进制文件已停止工作”。 所以,起初,我认为这与我的代码有关,并添加了许多附加到文本文件的调试语句。 当它崩溃时,我检查了文本文件,其中没有列出未完成的运行。 然后我在我的主要方法中添加了一个打印语句: public static void main (String[] args) { System.out.println ("Main Method Called"); new Runner (args); } 然后我不断地从命令行运行 Java 程序,直到它崩溃,我注意到一些有趣的事情。 在崩溃时,它从未打印过“调用的主要方法”。 现在,我觉得这很有趣,因为这告诉我崩溃的不是我的 Java 程序,而是 Java 本身。 然后我继续向我的命令行添加详细的打印语句: java -verbose:class -verbose:gc -verbose:jni -jar ... 从那里,我继续这个过程,直到程序再次失败。 当它失败时
  • Why does JVM randomly crashes on Windows Server 2012 due to NTDLL.DLL?
    My production server occasionaly crashes the java.exe sevice and therefore myApplication Server Glassfish 4.1. It happens randomly and so far I couldn't find a reason to explain such behavior. Checking Win Server 2012 Event Viewer, it is stated that the Application Error is due to conflict with NTDLL.DLL. Down below I post the dump collected after one of these crashes: Version=1 EventType=APPCRASH EventTime=130971776990222439a ReportType=2 Consent=1 ReportIdentifier=60c166c2-ba16-11e5-8100-22000afdaf63 IntegratorReportIdentifier=60c166c1-ba16-11e5-8100-a22000afdaf63 NsAppName=java.exe Response
  • 安装IE9后,Visual Studio 2012崩溃(错误模块ntdll.dll)(Visual Studio 2012 Crashes after installing IE9 (Faulting Module ntdll.dll))
    问题 好的.... 自从Visual Studio RTM在我的工作计算机上发布以来,我一直在运行它。 上周五,我安装了IE并将其更新至版本9,以测试JavaScript问题。 安装IE9并重新启动计算机后,Visual Studio 2012不再起作用,它将打开并显示开始页面约一秒钟,然后崩溃。 我尝试了以下失败: 恢复为IE8-仍然崩溃运行devenv / SafeMode-仍然崩溃运行devenv / ResetSettings-仍然崩溃修复VS2012-仍然崩溃完全卸载VS2012并重新安装-仍然崩溃完全卸载VS2012,删除所有VS2012文件夹和注册表项,然后重新安装-仍然崩溃 (重新)更新为IE9,卸载vs2012并重新安装-仍然崩溃 (每一个细致的步骤后无数重新启动) PS我无法运行“系统还原”,因为该操作“已被您的管理员禁用”,如果我可以使用的话,该操作将在上述步骤4之前进行... 当我运行devenv(是否使用安全模式)时,在应用程序事件日志中得到以下信息: Faulting application name: devenv.exe, version: 11.0.50727.1, time stamp: 0x5011ecaa Faulting module name: ntdll.dll, version: 6.1.7601.17725, time stamp
  • WinDbg x64: Cannot debug a crash dump - failed to load data access DLL
    I attached WinDbg to a running process and had the process crashed (I have a separate question re. that case). Once the program crashed, WinDbg stopped and allowed me to debug the program. I took a crash dump for further investigation with a command ".dump /ma". The program was compiled as "Any CPU" and I used WinDbg x64 to take the dump. Now I open WinDbg x64 on the same computer again and open the crash dump. Here is what it says: Loading Dump File [C:\crashdump.dmp] User Mini Dump File with Full Memory: Only application data is available Symbol search path is: SRV*c:\symbols*http://msdl
  • Visual Studio 2012 Crashes after installing IE9 (Faulting Module ntdll.dll)
    Okay.... I've been running Visual Studio RTM since it's release on my work computer. Last Friday I installed/Updated IE to version 9 to test a JavaScript issue. After installing IE9 and rebooting my computer Visual Studio 2012 no longer works, it opens shows the start page for about a second then crashes. I've unsuccessfully tried the following: Revert to IE8 -- still crashes Run devenv /SafeMode -- still crashes Run devenv /ResetSettings -- still crashes Repair VS2012 -- still crashes Uninstall VS2012 completely and Reinstall -- still crashes Uninstall VS2012 completely, removing all VS2012
  • Silverlight 5 - Debugging npctrl.dll crash
    I'm getting a really frustrating silverlight plugin crash which affects both IE and firefox. The error from the event log is: Faulting application name: iexplore.exe, version: 9.0.8112.16421, time stamp: 0x4d76255d Faulting module name: npctrl.dll, version: 5.0.61118.0, time stamp: 0x4ec5fc64 Exception code: 0xc0000094 Fault offset: 0x0001d720 Faulting process id: 0x434 Faulting application start time: 0x01ccf0b878b55ca7 Faulting application path: C:\Program Files (x86)\Internet Explorer\iexplore.exe Faulting module path: c:\Program Files (x86)\Microsoft Silverlight\5.0.61118.0\npctrl.dll
  • Ctrl-C crashes Python after importing scipy.stats
    I'm running 64-bit Python 2.7.3 on Win7 64-bit. I can reliably crash the Python interpreter by doing this: >>> from scipy import stats >>> import time >>> time.sleep(3) and pressing Control-C during the sleep. A KeyboardInterrupt is not raised; the interpreter crashes. The following is printed: forrtl: error (200): program aborting due to control-C event Image PC Routine Line Source libifcoremd.dll 00000000045031F8 Unknown Unknown Unknown libifcoremd.dll 00000000044FC789 Unknown Unknown Unknown libifcoremd.dll 00000000044E8583 Unknown Unknown Unknown libifcoremd.dll 000000000445725D Unknown
  • 在 0x00007FF93E507A7A (ntdll.dll) 处抛出异常。访问冲突读取位置 0xFFFFFFFFFFFFFFFF(Exception thrown at 0x00007FF93E507A7A (ntdll.dll) .Access violation reading location 0xFFFFFFFFFFFFFFFF)
    问题 我正在使用 POCO lib 来工作网络。 我使用 POCO/JSON 的 JSON 数据。 我的代码: User user(context.marshal_as<std::string>(tbUserName->Text), context.marshal_as<std::string>(tbFullName->Text), context.marshal_as<std::string>(tbDisplayName->Text), context.marshal_as<std::string>(tbEmail->Text), context.marshal_as<std::string>(tbPhoneNumber->Text), context.marshal_as<std::string>(tbNamSinh->Text), context.marshal_as<std::string>(tbPassword->Text), context.marshal_as<std::string>(tbConfirm->Text) ); string jsonString = user.serialize(); 我在0x00007FF93E507A7A ( ntdll.dll ) 处抛出错误异常: 0xC0000005:访问冲突读取位置 0xFFFFFFFFFFFFFFFF。
  • Service and Web Reference crashes Visual Studio
    When I move the mouse over any of these two or right click any of them Visual Studio crashes with the following message in the event log: Felet uppstod i programmet med namn: devenv.exe, version 9.0.30729.1, tidsstämpel 0x488f2b50 , felet uppstod i modulen med namn: ntdll.dll, version 6.1.7600.16385, tidsstämpel 0x4a5bdb3b Undantagskod: 0xc0000374 Felförskjutning: 0x000cdcbb Process-ID: 0xef4 Programmets starttid: 0x01cb07b7f1bd036d Sökväg till program: C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe Sökväg till modul: C:\Windows\SysWOW64\ntdll.dll Rapport-ID
  • 未找到 QtGui4.dll 入口点(QtGui4.dll entry point not found)
    问题 我正在尝试在 Windows 中编写 Qt3D 应用程序。 当我尝试编译程序并运行它时出现错误。 错误消息是:'在动态链接库 QtGui4.dll 中找不到过程入口点 ??4QImage@@AEAAV0@$$QAV0@@Z'。 我的编译器是 Microsoft Visual C++ 9.0,Qt 版本是 4.8.1。 有什么解决办法吗? 回答1 您是否在从 IDE 和独立 exe 运行,以及在调试和发布模式下都面临问题。 如果其中一些工作正常,请确保将正确的 QtGui4.dll 复制到生成可执行文件的同一路径。
  • Visual Studio 2010 反复崩溃(Visual Studio 2010 crashes repeatedly)
    问题 我已经运行 Visual Studio 2010(官方版本)有一段时间了。 最近,在我 8 小时的工作日内,VS 会崩溃 10 多次。 在 VS2008 中,处理大型 Xaml 文件时崩溃很常见,虽然我在 VS2010 中遇到过一些崩溃,但在调试、启动调试器、停止调试器和编辑代码时的其他随机时间时会发生崩溃。 我查看了问题报告,我发现最常出现的问题是: 描述错误的应用程序路径:C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe 问题签名问题事件名称:APPCRASH 应用程序名称:devenv.exe 应用版本:10.0.30319.1 应用时间戳:4ba1fab3 故障模块名称:ntdll.dll 故障模块版本:6.1.7600.16385 故障模块时间戳:4a5bdb3b 异常代码:c0000005 异常偏移:0002e23e 我正在运行 Windows 7 (x64)。 希望有人遇到过这个问题并找到了解决方案。 我打算重新安装VS2010。 希望这能解决问题。 回答1 您是否认为您安装了任何可能导致频繁崩溃的额外扩展? 你可以试试 Devenv.exe /SafeMode 以安全模式启动。 你也可以试试 Devenv.exe /Log 这将记录所有活动。
  • 服务和 Web 引用使 Visual Studio 崩溃(Service and Web Reference crashes Visual Studio)
    问题 当我将鼠标移到这两个中的任何一个上或右键单击其中任何一个时,Visual Studio 崩溃并在事件日志中显示以下消息: “错误”:0x01cb07b7f1bd036d 程序路径:C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe 模块路径:C:\Windows\SysWOW64\ntdll.dll 报告 ID:46c92fc7-73ab-11df -b110-002481038dc3 不幸的是,它在 Visual Studio 2010 和 Visual Studio 2008 中是一样的。我尝试修复安装,将所有设置重置为默认值并卸载我拥有的所有插件,但没有任何明显的结果。 有没有人知道发生了什么? 英语的突出部分: 错误的应用程序 devenv.exe,版本 9.0.30729.1,时间戳 0x488f2b50,错误的模块 ntdll.dll,版本 6.1.7600.16385,时间戳 0x4a5bdb3b,异常代码 0xc0000374,错误偏移量 0x000370 0x000000000000000000000000000000000000000000000000000 回答1 您是否安装了 ReSharper? 错误代码 0xC0000374 表示堆损坏
  • ntdll模块无法在windbg中正确加载,但是为什么呢?(ntdll module not loading correctly in windbg, but why?)
    问题 我以前使用windbg进行用户模式调试,但是我怀疑我对系统做了一些操作,因为我不记得以前使用扩展命令!heap时遇到了问题。 我可以清楚地看到ntdll是一个加载的模块: 77760000 778e0000 ntdll (pdb symbols) C:\Program Files (x86)\Windows Kits\8.1\Debuggers\x86\sym\wntdll.pdb\FA9C48F9C11D4E0894B8970DECD92C972\wntdll.pdb 0:001> lmvm ntdll start end module name 77760000 778e0000 ntdll (pdb symbols) C:\Program Files (x86)\Windows Kits\8.1\Debuggers\x86\sym\wntdll.pdb \FA9C48F9C11D4E0894B8970DECD92C972\wntdll.pdb Loaded symbol image file: C:\Windows\SysWOW64\ntdll.dll Image path: C:\Windows\SysWOW64\ntdll.dll Image name: ntdll.dll Timestamp: Wed Jul 15 13:53:36 2015 (55A69E20)
  • 在 Visual Studio 中调试转储文件(Debugging dump files in Visual Studio)
    问题 我使用的是 Visual Studio 2010 专业版和 Windows Vista。 首先,我有这个代码。 如您所见,它会使程序崩溃! using System; namespace Crash { class Program { static void Main(string[] args) { string a = null; if (a.Length == 12) { // ^^ Crash } } } } 程序将在 if 语句上崩溃。 现在,我想知道它在那个 if 语句上崩溃了。 如果我从 Visual Studio“启动而不调试”,则 Crash.exe 会崩溃。 它使用 1,356kb 的内存。 我得到了关闭程序/调试的 Vista 选项。 如果我选择调试,我可以打开一个新的 Visual Studio 实例,它会指向 if 语句中的 NullReferenceException。 这很好。 现在让我假设它在另一台计算机上崩溃,我让他们通过任务管理器给我一个转储文件。 它是 54,567kb。 怎么这么大! 它是广阔的! 反正我对那个不太感兴趣(稍微) 如果我用 Windbg 打开那个转储,我的未经训练的眼睛几乎没有用: Microsoft (R) Windows Debugger Version 6.12.0002.633 X86 Copyright (c)