Article directory
background
After the project went online, it was found that the following exceptions would occur every once in a while:
Caused by: java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread.java:714)
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:950)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1357)
at java.util.concurrent.CompletableFuture.asyncRunStage(CompletableFuture.java:1640)
at java.util.concurrent.CompletableFuture.runAsync(CompletableFuture.java:1858)
Troubleshoot
There are two possible reasons:
- The JVM memory is too small to continue creating threads: the configured -Xmx -Xms are all 10g, there is no reason not enough
- The operating system limit has been reached, so the thread cannot be created: the root account is enabled