Skip to content

OS-level thread exhaustion #173

@dmlloyd

Description

@dmlloyd

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions