OutOfMemoryError leaves indexing task in a bad state
I have been having problems with peons that encounter an OutOfMemoryError. The processes do not die, and my cluster ended up in a state where no new peons would be launched (even after killing off zombie processes and restarting everything).
2016-07-21T15:37:17,028 ERROR [task-runner-0-priority-0] io.druid.indexing.overlord.ThreadPoolTaskRunner - Exception while running task[KafkaIndexTask{id=index_kafka_sor_business_event_success_v1_c089007654756ec_kkbomemk, type=index_kafka, dataSource=sor_business_event_success_v1}] java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space at com.google.common.base.Throwables.propagate(Throwables.java:160) ~[guava-16.0.1.jar:?] at io.druid.segment.realtime.appenderator.FiniteAppenderatorDriver.persist(FiniteAppenderatorDriver.java:234) ~[druid-server-0.9.1.jar:0.9.1] at io.druid.indexing.kafka.KafkaIndexTask.run(KafkaIndexTask.java:463) ~[?:?] at io.druid.indexing.overlord.ThreadPoolTaskRunner$ThreadPoolTaskRunnerCallable.call(ThreadPoolTaskRunner.java:436) [druid-indexing-service-0.9.1.jar:0.9.1] at io.druid.indexing.overlord.ThreadPoolTaskRunner$ThreadPoolTaskRunnerCallable.call(ThreadPoolTaskRunner.java:408) [druid-indexing-service-0.9.1.jar:0.9.1] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_91] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_91] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_91] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91] Suppressed: java.util.concurrent.RejectedExecutionException: Got Interrupted while adding to the Queue at io.druid.concurrent.Execs$1.rejectedExecution(Execs.java:123) ~[druid-common-0.9.1.jar:0.9.1] at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:823) ~[?:1.8.0_91] at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1369) ~[?:1.8.0_91] at com.google.common.util.concurrent.MoreExecutors$ListeningDecorator.execute(MoreExecutors.java:484) ~[guava-16.0.1.jar:?] at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112) ~[?:1.8.0_91] at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:50) ~[guava-16.0.1.jar:?] at io.druid.segment.realtime.appenderator.AppenderatorImpl.mergeBarrier(AppenderatorImpl.java:652) ~[druid-server-0.9.1.jar:0.9.1] at io.druid.segment.realtime.appenderator.AppenderatorImpl.abandonSegment(AppenderatorImpl.java:1021) ~[druid-server-0.9.1.jar:0.9.1] at io.druid.segment.realtime.appenderator.AppenderatorImpl.close(AppenderatorImpl.java:758) ~[druid-server-0.9.1.jar:0.9.1] at io.druid.indexing.kafka.KafkaIndexTask.run(KafkaIndexTask.java:526) ~[?:?] at io.druid.indexing.overlord.ThreadPoolTaskRunner$ThreadPoolTaskRunnerCallable.call(ThreadPoolTaskRunner.java:436) [druid-indexing-service-0.9.1.jar:0.9.1] at io.druid.indexing.overlord.ThreadPoolTaskRunner$ThreadPoolTaskRunnerCallable.call(ThreadPoolTaskRunner.java:408) [druid-indexing-service-0.9.1.jar:0.9.1] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_91] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_91] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_91] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91] Caused by: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_91] at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_91] at io.druid.segment.realtime.appenderator.FiniteAppenderatorDriver.persist(FiniteAppenderatorDriver.java:226) ~[druid-server-0.9.1.jar:0.9.1] ... 7 more Caused by: java.lang.OutOfMemoryError: Java heap space 2016-07-21T15:37:17,033 INFO [task-runner-0-priority-0] io.druid.indexing.overlord.TaskRunnerUtils - Task [index_kafka_sor_business_event_success_v1_c089007654756ec_kkbomemk] status changed to [FAILED].
You can keep this from happening, instead favoring killing the task, by adding druid.indexer.runner.javaOptsArray=["-XX:OnOutOfMemoryError=kill -9 %p"] to your middle manager runtime properties.
-XX:+ExitOnOutOfMemoryError should work too, if you're using java 8u91+.
My posture on this is that -XX:+ExitOnOutOfMemoryError is the best way to deal with this. An OOME somewhere deep in the system can throw all sorts of things out of whack if one tries to recover from it, so letting the normal process failure mechanisms deal with that seem best.
I will try using -XX:+ExitOnOutOfMemoryError. However my larger concern is that my cluster got into a state where no new peons would launch. No errors in any of the logs. The overlord indicates that the task was moved into a Running state, but no peon was launched on the middle manager.
@benvogan when you're in the state where peons aren't launching, what is the overlord console showing as its view of the state of the system (does it still show the previous tasks that failed with OOM as running or as failed, does it show the middle managers as having any available capacity left)? Also after you restart, do you see logs on the overlord showing the supervisor creating any new tasks, or does it detect the previous tasks as being valid/running and therefore not create a new set of tasks?
I have been unable to put myself back into this state since I wiped by environment. However, the overlord was showing the middle managers as having all slots but one available (there was one task in a running state even though it did not have a peon process), which is why it was so odd that the other task ended up in a pending state. I do not recall exactly what happened on a restart of the overlord other than it didn't change my final state - sorry I don't remember if it created new tasks or not. If this happens again I will make sure to save the logs.
This issue has been marked as stale due to 280 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the [email protected] list. Thank you for your contributions.
This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.