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

Unhandled exceptions in threads should halt the program #1667

Open
albertz opened this issue Dec 13, 2024 · 1 comment
Open

Unhandled exceptions in threads should halt the program #1667

albertz opened this issue Dec 13, 2024 · 1 comment
Assignees

Comments

@albertz
Copy link
Member

albertz commented Dec 13, 2024

I don't really like that we have threads crashing and that this just stays unnoticed (as it was the case in #1643). Shouldn't we stop the whole program when we get an unhandled exception? For the main thread, this is the case.

Is there an easy way to get this behavior? Also that we maybe have better_exchook installed in all threads?

Basically, we should set sys.excepthook in every thread to our custom handler, which then does:

  • call better_exchook
  • call _thread.interrupt_main()

There is threading.excepthook (since Python 3.8), is this what we want?

@albertz
Copy link
Member Author

albertz commented Dec 13, 2024

There is threading.excepthook (since Python 3.8), is this what we want?

It sounds like this is what we want. But we need Python 3.8. Currently RETURNN still supports Python 3.7. But I think we should increase this to Python 3.8. See #1326.

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

No branches or pull requests

2 participants