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

OS-level thread exhaustion #173

Open
dmlloyd opened this issue May 10, 2024 · 2 comments
Open

OS-level thread exhaustion #173

dmlloyd opened this issue May 10, 2024 · 2 comments

Comments

@dmlloyd
Copy link
Contributor

dmlloyd commented May 10, 2024

If the OS runs out of native threads, the JDK's response is to throw an OutOfMemoryError from Thread#start. Presently, EnhancedQueueExecutor catches such errors and wraps them into a RejectedExecutionException (as a suppressed throwable).

We can take other actions as well, including (but not limited to):

  • Propagating the error directly instead of wrapping it (I don't recommend this though)
  • Passing the error to the default thread uncaught exception handler, in the hopes that it has some sensible policy (for example, maybe this would trigger "crash on OOME" on some JVMs; this would have to be tested though because by default it is just null) (Update I just verified that there is no uncaught exception handler installed in this case, at least on Temurin)
  • Logging a warning
  • Force a System.abort() when caught (perhaps after logging a message, hopefully the log is autoflushing)
@dmlloyd
Copy link
Contributor Author

dmlloyd commented May 10, 2024

/cc @franz1981, @cescoffier

@cescoffier
Copy link

I like the second approach. I think it's the most flexible one.

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