I’m seeing a strange java.lang.OutOfMemoryError error (partial stack trace below). The thing is that the java process does not crash. I see this error in the logs but the process seems to stall but does not exit.
Thanks.
Exception in thread "main" java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread.java:691)
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:943)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1325)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:132)
at com.amazonaws.services.s3.transfer.internal.UploadMonitor.<init>(UploadMonitor.java:126)
at com.amazonaws.services.s3.transfer.TransferManager.upload(TransferManager.java:384)
at com.amazonaws.services.s3.transfer.TransferManager.upload(TransferManager.java:344)
at com.amazonaws.services.s3.transfer.TransferManager.upload(TransferManager.java:272)
This is due to the fact that no more native threads could be created from your app.
Check the number of Threads your app is spawning. Most likely this is the culprit.
You can take a Thread dump for analyzing this.
Then check your stack size.
Xssparam will give you that. Try tweaking it.Increasing
Xmxwon’t help you here. In fact on 32 bit JVMs it will exacerbate the issue.The reason why your process is not stopping is because of the fact that Uncaught Exceptions only terminate their own thread, not the entire application as mentioned by Jan in the comments.