This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Python Crashes Exception code 0xc0000374 ntdll.dll
Type: Stage: resolved
Components: ctypes, Extension Modules, Windows Versions: Python 3.8
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: paul.moore, steve.dower, strantor, terry.reedy, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2020-11-12 19:56 by strantor, last changed 2022-04-11 14:59 by admin. This issue is now closed.

File name Uploaded Description Edit
Python Crash strantor, 2020-11-12 19:56 crash logs
Messages (4)
msg380847 - (view) Author: Charles Staton (strantor) Date: 2020-11-12 19:56
Hello, I am experiencing crashes of Python 3.8.5 (32 bit) on multiple identical Windows 10 x64 (Enterprise 2016 LTSB) machines. The Crashes are of the sort with the Windows popup "Python has stopped working" and there is no traceback.

The crashes occur sporadically. My program might run several days or just an hour, but invariably Python will crash if you wait long enough. I have attached a zip file containing all of the information provided by Windows in Application Logs, as well as some AppVerifier logs. I do not believe the AppVerifier logs are relevant however, as running my program with AppVerifier turned on causes Python to crash immediately upon startup and the information provided by Windows in Application Logs seems to indicate that it's AppVerifier crashing, not Python.

My program is quite large and is importing several libraries. It has a PyQt5 GUI, and I'm using PyQt5's QThreadpool() to run several threads concurrently which do various things like: communicate with a web API (rauth, requests), communicate with a PLC (pyModbusTCP), communicate with another PLC (python-Snap7), communicate with an RS485 printer (pySerial), write CSV logs to a network drive, et. al. 

I'm running this program in a venv setup by PyCharm. The full information is in the attached zip file but here's an excerpt:

Faulting application name: python.exe, version: 3.8.5150.1013, time stamp: 0x5f15bc04
Faulting module name: ntdll.dll, version: 10.0.14393.206, time stamp: 0x57dacde1
Exception code: 0xc0000374
Fault offset: 0x000d9841
Faulting process id: 0x1550
Faulting application start time: 0x01d6b839c684e37d
Faulting application path: C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\python.exe
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
Report Id: 24636ab4-7c06-4cd6-b8f8-4e20bfc59dce

Googling various clues has given me a vague clue that this is caused by Python attempting to access memory that it shouldn't. I have no idea how that happens or why. I'm clueless as to how I should go about troubleshooting this. If anyone can help I will be very grateful.
msg380960 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-11-14 08:00
When python as delivered crashes running pure non-ctype Python code, we usually consider it a bug to be fixed.  As soon as one pokes around with ctypes or imports 3rd party binaries, the crash is usually due to a user or 3rd par.  So this probably should be closed as 'not a (cpython) bug' or '3rd party', at least until the crash can be duplicated run pure python.  I am leaving it open for now in case someone checks the zip.

You might get more help posting on python-list with an import list or zip requirements.txt.  Some other user might know something about intermittent crashes in one of the packages.
msg381145 - (view) Author: Charles Staton (strantor) Date: 2020-11-16 19:40
I'm closing this. I have done a lot of research that seems to point to the way I'm handling threads as the cause, not Python itself.
msg381207 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-11-17 06:18
Thank you.  Good luck tracking down the problem.
Date User Action Args
2022-04-11 14:59:38adminsetgithub: 86501
2020-11-17 06:18:38terry.reedysetmessages: + msg381207
2020-11-16 19:40:27strantorsetstatus: open -> closed
resolution: not a bug
messages: + msg381145

stage: resolved
2020-11-14 08:00:39terry.reedysetnosy: + terry.reedy, paul.moore, tim.golden, zach.ware, steve.dower
messages: + msg380960
components: + Extension Modules, Windows, - Interpreter Core, Library (Lib)
2020-11-12 19:56:42strantorcreate