Skip to content

Conversation

@virtuald
Copy link
Member

@virtuald virtuald commented Feb 7, 2025

  • This occurs because our notifier uses a python thread instead of a C++ thread, and (I think) Python tries to kill it via pthread_cancel, which causes a weird exception to occur, which causes SIGABRT when we try to acquire the GIL
  • Instead we just hang the thread, an approach recently taken by python itself
  • Long term we should switch back to a C++ thread
  • Fixes [BUG]: SIGABRT in PyNotifier on sim exit #147

- This occurs because our notifier uses a python thread instead of a C++
  thread, and (I think) Python tries to kill it via pthread_cancel,
which causes a weird exception to occur, which causes SIGABRT when we
try to acquire the GIL
- Instead we just hang the thread, an approach recently taken by python
  itself
- Long term we should switch back to a C++ thread
- Fixes #147
@virtuald virtuald merged commit f27a714 into main Feb 8, 2025
28 checks passed
@virtuald virtuald deleted the safer-notifier branch February 8, 2025 01:40
// when we try to obtain the GIL again
// - this is a daemon thread so it's fine?
// - Python 3.14 does this too
while(true) {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW it looks like CPython's PyThread_hang_thread either sleeps indefinitely or calls the pause syscall, rather than busy looping. Might be worth doing the same here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: SIGABRT in PyNotifier on sim exit

2 participants