JDK-8336476 : Possible race condition accessing the singleton Application instance
  • Type: Bug
  • Component: javafx
  • Sub-Component: window-toolkit
  • Affected Version: jfx11,8
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2024-07-16
  • Updated: 2024-12-18
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
jfx25Unresolved
Related Reports
Relates :  
Description
During the review of PR 1506 [1] for JDK-8299738, Andy discovered that the singleton glass Application instance is accessed by multiple threads, without the static `application` field being properly synchronized.

During the normal operation of JavaFX, this isn't a problem, but we need to examine the toolkit startup and shutdown, particularly the latter.

In addition to the Application singleton, there is an `eventThread` variable in that class that should also be examined. Similarly, the Toolkit class should be examined, and particularly the static `fxUserThread` field.

[1] https://github.com/openjdk/jfx/pull/1506#discussion_r1678448367
Comments
We should consider either making the setters and getters synchronized, or making the fields volatile.
16-07-2024