title: How To Trace A Tricky JavaFx Freeze / Hang
body: <p>I have a JavaFX 8 app that is occasionally hanging/freezing. I feel I've ruled out many causes of the problem, but it's still happening.</p>
  
  <p>Unfortunately I cannot reproduce the freeze/hang on demand. It actually only happens (so far) on my colleague's computer. It can happen not long after the App has been running, or it may happen after many hours, or it may not happen at all. It does <em>not</em> happen after any user initiated event (such as pressing a button).</p>
  
  <p>I have a few background threads running that read data from sockets and update the JavaFX UI. These updates are always done via the Platform.runLater() method.</p>
  
  <p>The background threads may read many hundreds of data updates per second, so I have applied throttling to prevent too many updates on the UI, as suggested here: <a href="https://stackoverflow.com/questions/23488280/throttling-javafx-gui-updates">Throttling javafx gui updates</a></p>
  
  <p>The user can initiate some long(ish) tasks, which are run on the JavaFX UI thread, or using the Task method. I know and expect the JavaFX UI to block/freeze when calling a method with long execution time on the JavaFX UI thread. But such calls are <em>only</em> made by the user pressing a button and as stated above, the freeze occurs without the user interacting the the App in any way. </p>
  
  <p>I have caught the freezing (twice) on my colleagues computer and inspected the process in JConsole and VisualVM. The thread dump showed no deadlocks. When I compare the thread dump with a non-frozen JavaFX App thread dump, there are no obvious differences.</p>
  
  <p>It appears that only the JavaFX UI is frozen. The background threads continue without error.</p>
  
  <p>The CPU is not high and the computer is not running slow when the freeze occurs.</p>
  
  <p>My App code consists of many classes, so it's not straight forward to include it here, especially as I don't know which method causes to freeze. And therefore my question is rather broader than I would like:</p>
  
  <ol>
  <li>Given the assertions above, do you have any suggestions as to what
  might be a cause of such an error? </li>
  <li>Given the assertions above, do
  you have any suggestions as to what might be another way to trace
  such an error?</li>
  </ol>