Skip to content
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

Importing fido2.hid causes Abort trap: 6 on macOS 13.6.5 #216

Open
neverpanic opened this issue Mar 25, 2024 · 4 comments
Open

Importing fido2.hid causes Abort trap: 6 on macOS 13.6.5 #216

neverpanic opened this issue Mar 25, 2024 · 4 comments

Comments

@neverpanic
Copy link

:) cllang@cllang-mac:~$ python3.12 -c 'import fido2'
:) cllang@cllang-mac:~$ python3.12 -c 'import fido2.hid'
Abort trap: 6

Tested with fido2 1.1.3 and Python 3.12.2 from MacPorts on macOS 13.6.5 22G621.

The backtrace for the crash is

(lldb) thread backtrace
* thread #2, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x00007ff80d5c5196 libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007ff80d5fcee6 libsystem_pthread.dylib`pthread_kill + 263
    frame #2: 0x00007ff80d523b45 libsystem_c.dylib`abort + 123
    frame #3: 0x000000010313572e libffi.8.dylib`dlfree + 2991
    frame #4: 0x00000001031cf5e0 _ctypes.cpython-312-darwin.so`CThunkObject_dealloc + 41
    frame #5: 0x00000001007b2d3d Python`dictkeys_decref.llvm.16115435366937117356 + 151
    frame #6: 0x00000001007b5f1f Python`dict_dealloc + 247
    frame #7: 0x00000001031c8ce2 _ctypes.cpython-312-darwin.so`PyCData_clear + 93
    frame #8: 0x00000001031c9f09 _ctypes.cpython-312-darwin.so`PyCFuncPtr_clear + 353
    frame #9: 0x00000001031c94eb _ctypes.cpython-312-darwin.so`PyCFuncPtr_dealloc + 14
    frame #10: 0x00000001007e58e5 Python`subtype_dealloc + 798
    frame #11: 0x00000001007b2d3d Python`dictkeys_decref.llvm.16115435366937117356 + 151
    frame #12: 0x00000001007b660c Python`dict_tp_clear + 9
    frame #13: 0x00000001008e9cb9 Python`gc_collect_main.llvm.884759508876051100 + 1125
    frame #14: 0x00000001008e983f Python`_PyGC_CollectNoFail + 49
    frame #15: 0x00000001008be02d Python`finalize_modules.llvm.12581047115581953725 + 1437
    frame #16: 0x00000001008bd772 Python`Py_FinalizeEx + 188
    frame #17: 0x00000001008e8464 Python`Py_RunMain + 472
    frame #18: 0x00000001008e87d1 Python`Py_BytesMain + 42
    frame #19: 0x00007ff80d2a241f dyld`start + 1903

If I stub out the elif sys.platform.startswith("darwin") block in hid/__init__.py and replace the three functions with lambdas that do nothing, this crash does not occur, so it must be caused by something in fido2.hid.macos.

If I comment both REGISTERED_READ_CALLBACK and REMOVAL_CALLBACK in hid/macos.py, the crash no longer happens.

@dainnilsson
Copy link
Member

Could you test with 1.1.2 and see if it was an issue there as well?

@neverpanic
Copy link
Author

Yes, same situation: The crash is present, and it disappears if I comment REGISTERED_READ_CALLBACK and REMOVAL_CALLBACK.

@neverpanic
Copy link
Author

neverpanic commented Mar 25, 2024

More data points, if I do this with Apple's /usr/bin/python3 (3.9.6) in a virtualenv, it does not fail.
With MacPorts Python 3.11 in a virtualenv, it also does not fail.

Sounds like a change in Python 3.12?

@neverpanic
Copy link
Author

Oh, and because I didn't mention it yet: This happens on shutdown – everything works fine until you end the program, at which point during cleanup and module unload it causes this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants