JDK-8340405 : JavaFX shutdown hook can hang preventing app from exiting
  • Type: Bug
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: jfx11,8
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-09-18
  • Updated: 2024-09-23
  • Resolved: 2024-09-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
jfx24 masterFixed
Related Reports
Relates :  
Relates :  
Description
The QuantumToolkit registers a "Glass/Prism Shutdown Hook" that calls the QuantumToolkit.dispose method to gracefully shutdown the toolkit and renderer. If dispose hangs or deadlocks, this will prevent the application from exiting, requiring the process to be killed.

This has been observed on macOS, due to JDK-8238505, which is is an intermittent deadlock that occurs during shutdown. We ought to eventually fix that intermittent deadlock, but even in the presence of a deadlock or hang, we don't want the shutdown hook to hang.

This can happen at any time, but is especially a problem during an automated test run, which will then hang until the Jenkins job is either killed or its global timer (currently set to 12 hours) kills the job. Even in that case, processes can be left lying around which can affect subsequent runs.

I discovered this while testing JDK-8328629, which adds a default Unit 5 timeout, and without fixing the deadlock, the timeout will be unable to abort the hanging test.

Comments
Changeset: addf0854 Branch: master Author: Kevin Rushforth <kcr@openjdk.org> Date: 2024-09-23 12:46:48 +0000 URL: https://git.openjdk.org/jfx/commit/addf0854dcd95fb8b78ad0dce4413c1170fd70eb
23-09-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jfx/pull/1574 Date: 2024-09-19 14:03:45 +0000
19-09-2024

The proposed fix is to call dispose from a background thread and wait for up to 5 seconds for it to finish normally, and then throw an Error so that the application will be able to exit anyway.
18-09-2024