title: How to capture on-JVM-exit heap dumps without affecting the ECS service?
body: <p>My JVM-based app runs on Amazon ECS. Under some conditions that I cannot reproduce on test environments it crashes with an OutOfMemoryError. I want to capture the JVM heap dump (using <code>HeapDumpOnOutOfMemoryError</code>) to see what's going on. But there is a problem - because my app uses a lot of memory, the heap dumping takes very long time and ECS kills the container in the middle of it, because the health checks fail. I end up with an unusable, truncated dump file.</p>
  
  <p>I can obtain a correct heap dump by changing the health-check configuration but it potentially affects the ECS service, because without good health-check the cluster can be running unresponsive instances.</p>
  
  <p>I'm looking for a way, that will let me capture the heap dumps automatically with smallest possible impact to the production cluster.</p>