With a trivial PySide6 application, faulthander indicates a "Windows fatal exception" {{0x8001010d }}on Windows 11 with python 3.12.0 and 3.11.6.
Here is the trivial application, also attached as demo.py:
from PySide6 import QtWidgets, QtGui
app = QtWidgets.QApplication([])
main = QtWidgets.QMainWindow()
main.show()
app.exec()
If we run with faulthandler like this:
python -X faulthandler demo.py
The output is:
Windows fatal exception: code 0x8001010d
Current thread 0x00007a18 (most recent call first):
File "C:\repos\Jetperch\demo.py", line 5 in <module>
The window opens and stays open, so this fatal exception does not cause a hard crash. Without faulthandler, there is no indication that any issue occurred.
The issue occurs on both python 3.11.6 and 3.12.0 with both PySide6 6.6.0 and 6.5.2. I have duplicated the issue both on a fresh python install and a virtual environment with only "python -m pip install PySide6".
I think this error is:
RPC_E_CANTCALLOUT_ININPUTSYNCCALL
An outgoing call cannot be made since the application is dispatching an input-synchronous call.
https://learn.microsoft.com/en-us/windows/win32/com/com-error-codes-3
Motiviation
I am seeing this in a larger application where the application sometimes crashes. I have no idea yet whether this is related.
It is very likely that no one has tried running with faulthandler, so this could be a longstanding latent issue.
Expected behavior
A trivial application should not cause a Windows fatal exception.
See also
- https://stackoverflow.com/questions/57523762/pytest-windows-fatal-exception-code-0x8001010d
- https://docs.python.org/3/library/faulthandler.html
Here is what ChatGPT4 has to say:
The error you're encountering, Windows fatal exception: code 0x8001010d, typically indicates that an operation was attempted on the wrong thread.
In the context of Qt and PySide6, it is important to ensure that all GUI-related operations are executed on the main thread. The main thread is the thread where QApplication was created and where the event loop is running. Any attempt to perform GUI operations from a different thread can result in this kind of fatal error.
From the code you've shown, everything appears to be on the main thread. However, there could be several external factors that could potentially lead to such an error:
Environment Issues: Your Python environment may have some conflicts. It might be a good idea to create a new virtual environment and install only the necessary packages to run your PySide6 application.
Installation Issues: There might be an issue with the PySide6 installation. You could try reinstalling PySide6 to see if it resolves the issue.
Concurrency: If you've modified your code or if there's anything else running concurrently that interacts with the Qt event loop, it might cause threading issues.
External Modules: If you're importing or using any other modules (not shown in the code snippet you provided), ensure that they are not causing any interference.
Version Compatibility: Ensure that the versions of Python and PySide6 you're using are compatible.