Gramps 6.0.4 [libpython3.12.dll] crashes under Win11

Hello,
I’ve been getting repeated system crashes on Windows 11 lately.
I start Gramps 6.0.4 and search by name using the filter, and suddenly an error message appears and the system restarts.
I can’t say exactly what the message says, as it disappears very quickly. However, I found an event log in the depths of Windows that appears to be related to the crash (it could be from the timing). I can’t reproduce the error either. It comes up whenever it wants…
Is it my system or Gramps?

Faulty application name: grampsw.exe, version: 6.0.4.0, timestamp: 0x689a078c
Faulting module name: libpython3.12.dll, version: 3.12.11150.1013, timestamp: 0x68443130
Exception code: 0xc0000005
Error offset: 0x00000000002e9550
Faulting process ID: 0x61E4
Faulting application start time: 0x1DC18FDCC6AF4B6
Faulting application path: C:\\Program Files\\GrampsAIO64-6.0.4\\grampsw.exe
Faulting module path: C:\\Program Files\\GrampsAIO64-6.0.4\\libpython3.12.dll
Report ID: 013ecd6e-bcd7-4a4c-a76a-535c369431d1
Full name of the faulty package:
Faulty package-related application ID:

The german original

Fehlerhafter Anwendungsname: grampsw.exe, Version: 6.0.4.0, Zeitstempel: 0x689a078c
Fehlerhafter Modulname: libpython3.12.dll, Version: 3.12.11150.1013, Zeitstempel: 0x68443130
Ausnahmecode: 0xc0000005
Fehleroffset: 0x00000000002e9550
Fehlerhafte Prozess-ID: 0x61E4
Fehlerhafte Anwendungsstartzeit: 0x1DC18FDCC6AF4B6
Fehlerhafter Anwendungspfad: C:\\Program Files\\GrampsAIO64-6.0.4\\grampsw.exe
Fehlerhafter Modulpfad: C:\\Program Files\\GrampsAIO64-6.0.4\\libpython3.12.dll
Berichts-ID: 013ecd6e-bcd7-4a4c-a76a-535c369431d1
Vollständiger Name des fehlerhaften Pakets:
Fehlerhafte paketbezogene Anwendungs-ID:

It looks like a python issue. The Debugging Gramps page in our wiki gives some information about debugging a hard crash.

1 Like

Does the computer actually restart!?! Or does Gramps spontaneously exit?

If it is just Gramps exiting:
To preserve those console messages that disappear too quickly, Start Gramps from a command line prompt (not the app or console app icons shown below).

1 Like

Windows restarts completely

2 Likes

Ok, but It’s all Greek to me ….

Perplexity notes that there are known bugs

Discussions from Python community forums and GitHub issues reveal that Python 3.12 has experienced crashes due to Windows 11’s thread detector feature and newer CPU models causing access violations (exception 0xc0000005), involving libpython3.12.dll. Downgrading to Python 3.11 or later patches might help.

continue the Perplexity session to follow online threads cited:
https://www.perplexity.ai/search/is-there-a-straightforward-way-P04YsueFT96Uyx2DEgiiPg#3

@nick Is using Python 3.11 an option with Gramps 6?

1 Like

Hmm, but I only installed Gramps. I didn’t install Python separately.

I actually have a newer processor.
An Intel Core i7 14700K

Gramps includes a Python sandbox with the installation. It is not a full development environment. Rather, it is a minimal, bundled Python runtime environment.

BTW, this is one of my pet peeves in discussions about starting development (or morelike hacking) in Gramps. All the development docs start with setting up a full Python development environment. That’s a major investment in labor. I think it is reasonable that users will start tweaking WITHOUT a full environment. They will just patch using a text editor and leverage the bundled runtime.

1 Like

Really? I don’t have Python on my home PC but I did have it on my work laptop. I don’t remember the installation being anything harder than downloading and the double clicking on the installer.

Of course, my memory could be wrong.

1 Like

The labor is in learning the tools and how they interact.

Just like Gramps is easy to install. But learning to tune and use it is a lot of labor.

1 Like

Yes. You can run Gramps v6.0 with python 3.9 and above.

The Windows AIO is shipped with python 3.12 because that’s the version available in MSYS2.

2 Likes

Ah, yes, I misunderstood your meaning.

Now I do understand I can confirm your meaning because although I had Python on my work laptop I never learnt how to use it :laughing:

2 Likes

Intel has a post which points to a BIOS update being necessary for instability issues. I do not have first-hand experience (I have an i9-12900K), but I am passing this along for you to follow-up.

2 Likes

After Brian pointed out that newer Intel CPUs might have issues, I updated a few drivers and even found device drivers that hadn’t been installed automatically.

Now everything is up to date, and Gramps is running without any problems or crashes. It’s also somehow faster. It’s probably my happy hormones :upside_down_face: .

Thanks for the help.

4 Likes

Hmmm. This brings up a judgement call.

If Gramps can run on 3.9 and there are existing bios / device driver issues that occur with Window 11 and newer processors but not earlier Python DLLs, should the Gramps sandboxed runtime drop back to the earlier version for the next AIO maintenence 6.0.5?

The deciding factors are:

  1. do the earlier Python DLL runtime versions resolve the same crash problems without the BIOS and/or device driver updates?
  2. does the older DLL degrade performance? (Such as for multi-threaded efficiency.)

I wonder if there is a safe (or, at least, controlled) test that can determine if the crash WILL occur or during startup of Gramps. A crash during a data commit could lose work or corrupt the database. Or in other open Windows applications with unsaved data. It would certainly leave the tree in a locked state.

Further exploration with Perplexity indicates that dropping back to 3.11 is purported to avoid the crash under Windows 11 and might be optimal.

  • Single-Threaded Performance:
    Python 3.9 is slower than Python 3.12: benchmarks show 3.12 is ~20–30% faster in many single-threaded scenarios thanks to interpreter optimizations, though 3.11 is often slightly faster than 3.12.dev

Only one python version is available in MSYS2 which is currently python 3.12.11.

1 Like

Where do we track the progress on this issue? I asked Perplexity to identify the properly isolated root cause. But where is it being worked?

What is the correct description for this bug affecting Python 3.12? Where it incorrectly calls the thread detector director, resulting in an exception code 0xc0000005

The correct description of the Python 3.12 bug affecting Windows 11 is:

Python 3.12’s runtime DLL (python312.dll) incorrectly invokes the Windows 11 thread detector director, which contains a bug particularly on advanced processors like the Intel 14900KS. This causes an access violation crash with exception code 0xc0000005. The crash typically occurs when Python scripts use threading or manage concurrent threads after initializing the interpreter in one thread and calling Python code from another thread, behavior that worked in Python versions prior to 3.12.

This issue is identified as a Windows 11 thread detector director bug triggered by python312.dll’s threading implementation, leading to a fault in Windows’ event viewer logs indicating the crash from mismatched thread detection direction or improper handling by Python 3.12.learn.microsoft+2

  1. Python script crashes on windows 11 - Microsoft Q&A
  2. Python script crashes on windows 11 - Microsoft Q&A
  3. Python 3.12 script crashes on windows 11 with 14900ks cpu - Python Help - Discussions on Python.org
  4. Crash with Python 3.12 via Boost Python On Concurrent Thread · Issue #135679 · python/cpython · GitHub
  5. FIXED: Simple python thread causes instant crash - Bugs - TouchDesigner forum
  6. Python 3.11 interperter crash on Windows 11 - Python Help - Discussions on Python.org
  7. [Python] Windows fatal exception: access violation · Issue #40100 · apache/arrow · GitHub
  8. RuntimeError: can't create new thread at interpreter shutdown. Python 3.12 - Stack Overflow
  9. What’s New In Python 3.12 — Python 3.13.7 documentation
  10. Trying to Download Python 3.12.3 on Windows 11 - Python Help - Discussions on Python.org

is it JUST the runtime? Or does the full Python development environment have the same problem?

The crash issue affecting Python 3.12 on Windows 11 is not limited to just the runtime DLL but impacts the full Python development environment. This means that whether running standalone Python scripts, Django management commands, or embedding Python in applications (e.g., via Boost.Python), the problem manifests due to a change in how Python 3.12 handles threading and interaction with Windows 11’s thread detector director.

Specifically:

  • The crash occurs when Python code is run on a different thread than the one used to initialize the interpreter (Py_Initialize). This was not an issue in previous Python versions.
  • It affects scripts, interactive sessions, and embedded development environments that start and run Python code with multiple threads.
  • Multiple user reports from Django apps, Qt5/Boost Python embedded scenarios, and general Python usage indicate the entire development environment is affected, not just Python.exe or python312.dll alone.
  • The problem triggers access violation exceptions (0xc0000005) related to Windows 11’s thread detector director.

Hence, the full Python 3.12 development environment, including runtime and multi-threaded application use cases, experiences this bug on affected Windows 11 hardware and OS versions.discuss.python+3

  1. Python 3.12 script crashes on windows 11 with 14900ks cpu - Python Help - Discussions on Python.org
  2. Python script crashes on windows 11 - Microsoft Q&A
  3. Gramps 6.0.4 [libpython3.12.dll] crashes under Win11
  4. Python script crashes on windows 11 - Microsoft Q&A
  5. Crash with Python 3.12 via Boost Python On Concurrent Thread · Issue #135679 · python/cpython · GitHub
  6. OR-Tools crashing Python 3.12 in Windows work environments only; perhaps MSVCP140.dll-related? - Stack Overflow
  7. What’s New In Python 3.12 — Python 3.13.7 documentation
  8. Trying to Sort Out Python Issues on Windows 11 - Python Help - Discussions on Python.org
  9. RuntimeError: can't create new thread at interpreter shutdown. Python 3.12 - Stack Overflow
  10. Installation Fails on python 3.12 windows 11 - [App]: · Issue #6519 · wandb/wandb · GitHub

give a complete list of the processors (or processor families) that would be affected

The Python 3.12 crash issue related to the Windows 11 thread detector director affects processors with hybrid architectures and advanced thread scheduling, specifically:

  • Intel 13th Gen CPUs such as the Intel Core i9-14900KS are confirmed affected.
  • Intel 12th Gen hybrid architecture processors that include both performance (“P”) cores and efficiency (“E”) cores under Windows 11 Thread Director are implicated.
  • The bug arises due to Windows 11’s thread scheduling and thread detector director feature interacting incorrectly with Python 3.12’s threading implementation.

An older generation CPU like Intel i9-9900K (non-hybrid) reportedly does not experience this crash issue, suggesting the problem is specific to newer hybrid-architecture CPUs using Windows 11 thread director technology.

Other hybrid processor families with similar Windows 11 thread scheduling might also be affected, but explicit details chiefly mention Intel 12th Gen and 13th Gen processors with hybrid architectures under Windows 11.

If expanded beyond Intel, similar hybrid or performance/efficiency core architectures on Windows 11 from other vendors could theoretically be impacted, but specific confirmed reports focus on Intel’s advanced multi-core CPUs on Windows 11 platform.discuss.python+2

  1. Python 3.12 script crashes on windows 11 with 14900ks cpu - Python Help - Discussions on Python.org
  2. Python script crashes on windows 11 - Microsoft Q&A
  3. Windows 11 22H2 Thread Director Issues with Intel 12th Gen CPU - Microsoft Q&A
  4. Are Python 3.12 subinterpreters multi-CPU? - Stack Overflow
  5. [Windows 11] cpu_percent affected by cpu_affinity · Issue #2251 · giampaolo/psutil · GitHub
  6. What’s New In Python 3.12 — Python 3.13.7 documentation
  7. PEP 703: Making the Global Interpreter Lock Optional (3.12 updates) - PEPs - Discussions on Python.org
  8. Concerns regarding deprecation of "fork()" with alive threads - Ideas - Discussions on Python.org
  9. Trying to Sort Out Python Issues on Windows 11 - Python Help - Discussions on Python.org

I believe the issue might be related to thread “director” and not “detector”. Again I purport no knowledge of the issue, throwing this out there so we don’t go on a wild goose chase.