기존에 잘 동작하던 서비스의 java version을 upgrade시키고 난 이후에 에러가 발생하게 되었다.
java 8 -> java 11
에러 내역
버전 업 이후에 thread 개수가 너무 많이 증가하여 out of memory 발생
Caused by: java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached
at java.base/java.lang.Thread.start0(Native Method)
at java.base/java.lang.Thread.start(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.createWorker(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.tryCompensate(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.awaitJoin(Unknown Source)
at java.base/java.util.concurrent.ForkJoinTask.doInvoke(Unknown Source)
at java.base/java.util.concurrent.ForkJoinTask.invoke(Unknown Source)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateParallel(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
ForkjoinPool 사용 부분
common thread pool을 사용하지 않고, custom thread pool을 생성