-
-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
macOS: SIGILL/SIGSEGV when exiting process #142
Comments
Have you tried the latest cython-hidapi which uses hidapi 0.13.1 release? |
I have just tested with shell history/commands
And btw here is the "report" from the macOS built-in crash reporter that it wants to send to the mothership (Apple): OS-level crash report
|
fixes trezor#142 fixes trezor#148 note trezor#148 (comment) : > HIDAPI on macOS has an additional issue regarding thread-safety. > I did encountered it in my project(s) but didn't have enough time to gather info/find a root cause. > Looks like on macOS hid_init/hid_exit needs to be called in the same thread, > which is an additional restriction compared to other platforms.
I can confirm the reproducer crashes under my Mac Mini M1 (2020 model) running latest macOS Ventura 13.3.1. And with PR #150, it no longer crashes. |
fixes #142 fixes #148 note #148 (comment) : > HIDAPI on macOS has an additional issue regarding thread-safety. > I did encountered it in my project(s) but didn't have enough time to gather info/find a root cause. > Looks like on macOS hid_init/hid_exit needs to be called in the same thread, > which is an additional restriction compared to other platforms.
Was added in 752b37a, due to upstream issue trezor/cython-hidapi#142, which should now be fixed in 0.14.0.
On macOS, when using hidapi in a thread other than the main thread, during shutdown of the python process, the application segfaults. AFAICS, depending on the macOS version, it might be a SIGILL or a SIGSEGV.
I've tested on macOS 10.15.3, 11.3, and 12.5, and all exhibit the issue.
Also tested on recent Ubuntu and Win10, both look unaffected.
All recent hidapi releases are affected since 0.11.0 (so last one that works well is 0.10.1).
Simple test case script:
After running script, OS crash reporter window pops up:
macOS crash reporter. "Python quit unexpectedly"
#128 and #130 look potentially related.
hidapi 0.10.1 works well
With hidapi 0.11.0+, note the
zsh: illegal hardware instruction
linehidapi==0.11.0
hidapi==0.11.0.post2
hidapi==0.11.2
hidapi==0.12.0.post2
The text was updated successfully, but these errors were encountered: