title: Freezes of JVM/Tomcat under load while safepoint-log logs thausends safepoints "ThreadStop" entries
body: <p>I have a problem with a Java application running in a Tomcat running with openJDK11. The problem is that after some time under high load, the application freezes. The CPU load then also collapses and no more entries are written in Catalina.out or application log files. After some time (1-2 minutes) the system recovers and runs normally.</p>
  <p>I first thought that there was a problem with the garbage collection and started the logging for garbage collections and safepoints.</p>
  <p>In the Safepoint log there are hundreds to thousands of entries (without interruption of other messages) at freeze times:</p>
  <pre><code>[2021-02-03T08:53:44.619+0100][5136.564s][info][safepoint] Application time: 0.0153146 seconds
  [2021-02-03T08:53:44.620+0100][5136.565s][info][safepoint] Entering safepoint region: ThreadStop
  [2021-02-03T08:53:44.621+0100][5136.566s][info][safepoint] Leaving safepoint region
  [2021-02-03T08:53:44.621+0100][5136.566s][info][safepoint] Total time for which application threads were stopped: 0.0020579 seconds, Stopping threads took: 0.0006463 second
  </code></pre>
  <p>The ThreadStop messages correspond 1:1 with the times of the freezes. Therefore the assumption that the ThreadStops are the cause for the problem.</p>
  <p>Unfortunately I could not find anything about ThreadStop Safepoints.</p>
  <p>Therefore the question, what triggers ThreadStop Safepoints? Are they the cause of the freezes? If so, how can I solve the problem?</p>
  <p>Thanks a lot</p>