JDK-8144258 : Ensemble Advanced Media sample hangs after going full screen
  • Type: Bug
  • Component: javafx
  • Sub-Component: window-toolkit
  • Affected Version: 8u60,9
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-11-30
  • Updated: 2020-01-31
  • Resolved: 2017-02-10
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.
JDK 8 JDK 9
8u152Fixed 9Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
1.  Run the Ensemble Advanced Media sample
2.  Click the Full Screen button
3a. Click ESC on the keyboard and the sample goes back to normal.
3b. Click the Full Screen button again and the sample keeps playing, but goes unresponsive hanging the UI.

Happens in 8u and 8-dev so not a regression.
Comments
Approved to backport to 8u-dev for 8u152.
10-02-2017

Changeset: dee28a9ba226 Author: vadim Date: 2017-02-09 18:49 +0300 URL: http://hg.openjdk.java.net/openjfx/9-dev/rt/rev/dee28a9ba226
10-02-2017

The .02 version looks good, and seems like the right fix. My testing looks good, too. +1
10-02-2017

The backport to 8u would be beneficial I think. It's identical to the fix and works fine too (I actually worked in 8u on this fix)
10-02-2017

Looks fine.
09-02-2017

Kevin, Chien, Alex, Please also look at this completely different version of the fix: http://cr.openjdk.java.net/~vadim/8144258/webrev.02/ It's kind of more straightforward and fixes the immediate problem. First, it prevent reentrant fullscreen exiting loop which caused the deadlock in the first place. Second, it releases nativeFullScreenModeWindow which is normally released in the sendJavaFullScreenEvent which is not called if the window is closed from the nested event loop.
09-02-2017

Here's the next version of the fix. http://cr.openjdk.java.net/~vadim/8144258/webrev.01/ As Kevin said, it's actually looks more like a workaround for a faulty native behaviour so if anybody have any concerns about that I will prepare another fix. OTOH, it makes the fullScreenProperty change timings to be in line with other notifications which sent after the transition (more like 'windowDidExitFullscreen' on Mac) The fix relies on the fact that peer's setFullScreen method will ultimately update the property through the listener for the ViewEvent.FULLSCREEN_ENTER/EXIT events. So in case of installed SecurityManager, the property would not be changed at all.
06-02-2017

Confirmed that this will cause the state of the fullScreenProperty variable to be out of sync. Specifically, the following unit test fails after applying the patch: gradle --continue --info -PFULL_TEST=true -PUSE_ROBOT=true :systemTests:test --tests test.robot.helloworld.CustomSecurityManagerTest
14-09-2016

One thing to check is whether the reordering of the property notification might cause a problem in the case where entering full-screen is rejected due to a security manager denying access. It seems possible that the Stage property could end up in the wrong state.
14-09-2016

David, Alexander, Please review this fix: http://cr.openjdk.java.net/~vadim/8144258/webrev.00/ Reordering the property notification was the easiest way to eliminate the problem. Notifying after the fullscreen change also seems to be the way other notifications work, like com.sun.glass.events.ViewEvent.FULLSCREEN_EXIT, which is sent only after the transition happened.
14-09-2016

MediaControl calls newStage.setFullscreen(false), which calls MacView._exitFullscreen which starts nested event loop. Now there's a listener on fullScreenProperty in the MediaControl, which jiggle stages around and calls runLater with newStage.close(). So this listener gets called from the nested event loop. Stage.close() calls View.close() with a render lock which again calls exitFullscreen, nested event loop and this time QuantumToolkit.pulse happens to be in the queue, which deadlocks when Scene.pulse calls waitForRenderingToComplete because render thread waits for the render lock to release. Probably the easiest solution would be to prevent reentrant exitFullScreen call.
08-09-2016

Vadim , please investigate
19-08-2016

This is not new. 9-client-defer-candidate: There is no resources to fix it in jdk9.
19-08-2016

Possibly related to JDK-8145393
03-05-2016

Does sound like a bug. Mac fullscreen does a bit more work than some of the other glass instances if I remember correctly. If I do remember it right, the we need a close look at where the lock deadlock it, and perhaps see about closing that window.
22-04-2016

As long as the close of the secondary stage is done on the FX application thread, then it is a perfectly valid thing to do. Tooltip and other popup windows will do this routinely. So I do think this is definitely a glass bug. Thanks for filing it.
22-04-2016

This is not really a Glass issue per se but more an issue with trying to close another stage during a full-screen operation. This leads to deadlock. The issue is that the AdvancedMediaApp uses a secondary stage to display the full-screen content, rather than sending the Ensemble8 window full-screen with an alternate layout for the Pane. Swapping the full-screen MediaControl back into the Ensemble8 seems to work ok, but the close() of the secondary stage is really something that is sketchy from an API standpoint. [java] "JavaFX Application Thread" #15 prio=5 os_prio=31 tid=0x00007fc09b895000 nid=0xa0b waiting on condition [0x00007fff54688000] [java] java.lang.Thread.State: WAITING (parking) [java] at jdk.internal.misc.Unsafe.park(Native Method) [java] - parking to wait for <0x000000078518da68> (a java.util.concurrent.CountDownLatch$Sync) [java] at java.util.concurrent.locks.LockSupport.park(LockSupport.java:190) [java] at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:869) [java] at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1023) [java] at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1332) [java] at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:232) [java] at com.sun.javafx.tk.quantum.PaintCollector.waitForRenderingToComplete(PaintCollector.java:157) [java] at com.sun.javafx.tk.quantum.GlassScene.waitForRenderingToComplete(GlassScene.java:122) [java] at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2547) [java] at com.sun.javafx.tk.Toolkit.lambda$runPulse$3(Toolkit.java:365) [java] at com.sun.javafx.tk.Toolkit$$Lambda$509/2057985117.run(Unknown Source) [java] at java.security.AccessController.doPrivileged(Native Method) [java] at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:364) [java] at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:391) [java] at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:509) [java] at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:489) [java] at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$11(QuantumToolkit.java:318) [java] at com.sun.javafx.tk.quantum.QuantumToolkit$$Lambda$42/497831068.run(Unknown Source) [java] at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96) [java] at com.sun.glass.ui.mac.MacApplication._enterNestedEventLoopImpl(Native Method) [java] at com.sun.glass.ui.mac.MacApplication._enterNestedEventLoop(MacApplication.java:110) [java] at com.sun.glass.ui.Application.enterNestedEventLoop(Application.java:511) [java] at com.sun.glass.ui.mac.MacView._exitFullscreen(Native Method) [java] at com.sun.glass.ui.View.close(View.java:514) [java] at com.sun.javafx.tk.quantum.ViewScene.lambda$dispose$0(ViewScene.java:98) [java] at com.sun.javafx.tk.quantum.ViewScene$$Lambda$671/262962190.get(Unknown Source) [java] at com.sun.javafx.tk.quantum.QuantumToolkit.runWithRenderLock(QuantumToolkit.java:406) [java] at com.sun.javafx.tk.quantum.ViewScene.dispose(ViewScene.java:97) [java] at javafx.scene.Scene.impl_disposePeer(Scene.java:876) [java] at javafx.stage.Window$12.invalidated(Window.java:1068) [java] at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:110) [java] at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:145) [java] at javafx.stage.Window.setShowing(Window.java:1111) [java] at javafx.stage.Window.hide(Window.java:1136) [java] at javafx.stage.Stage.close(Stage.java:1234) [java] at ensemble.samples.media.advancedmedia.MediaControl.lambda$onFullScreen$10(MediaControl.java:373) [java] at ensemble.samples.media.advancedmedia.MediaControl$$Lambda$664/1892754936.run(Unknown Source) [java] at com.sun.javafx.application.PlatformImpl.lambda$runLater$5(PlatformImpl.java:315) [java] at com.sun.javafx.application.PlatformImpl$$Lambda$50/1781292795.run(Unknown Source) [java] at java.security.AccessController.doPrivileged(Native Method) [java] at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:314) [java] at com.sun.javafx.application.PlatformImpl$$Lambda$49/1580893732.run(Unknown Source) [java] at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96) [java] at com.sun.glass.ui.mac.MacApplication._enterNestedEventLoopImpl(Native Method) [java] at com.sun.glass.ui.mac.MacApplication._enterNestedEventLoop(MacApplication.java:110) [java] at com.sun.glass.ui.Application.enterNestedEventLoop(Application.java:511) [java] at com.sun.glass.ui.mac.MacView._exitFullscreen(Native Method) [java] at com.sun.glass.ui.View.exitFullscreen(View.java:791) [java] at com.sun.javafx.tk.quantum.WindowStage.applyFullScreen(WindowStage.java:752) [java] at com.sun.javafx.tk.quantum.WindowStage.setFullScreen(WindowStage.java:788) [java] at javafx.stage.Stage.setFullScreen(Stage.java:667) [java] at ensemble.samples.media.advancedmedia.MediaControl$1.handle(MediaControl.java:306) [java] at ensemble.samples.media.advancedmedia.MediaControl$1.handle(MediaControl.java:251) [java] at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86) [java] at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238) [java] at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191) [java] at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59) [java] at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58) [java] at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) [java] at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) [java] at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) [java] at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) [java] at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) [java] at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74) [java] at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49) [java] at javafx.event.Event.fireEvent(Event.java:198) [java] at javafx.scene.Node.fireEvent(Node.java:8533) [java] at javafx.scene.control.Button.fire(Button.java:185) [java] at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:199) [java] at com.sun.javafx.scene.control.behavior.ButtonBehavior$$Lambda$334/247401134.handle(Unknown Source) [java] at com.sun.javafx.scene.control.inputmap.InputMap.handle(InputMap.java:274) [java] at com.sun.javafx.scene.control.inputmap.InputMap$$Lambda$204/96473202.handle(Unknown Source) [java] at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218) [java] at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80) [java] at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238) [java] at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191) [java] at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59) [java] at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58) [java] at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) [java] at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) [java] at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) [java] at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) [java] at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) [java] at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74) [java] at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54) [java] at javafx.event.Event.fireEvent(Event.java:198) [java] at javafx.scene.Scene$MouseHandler.process(Scene.java:3894) [java] at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3622) [java] at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1883) [java] at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2631) [java] at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:381) [java] at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:294) [java] at java.security.AccessController.doPrivileged(Native Method) [java] at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:417) [java] at com.sun.javafx.tk.quantum.GlassViewEventHandler$$Lambda$532/600489935.get(Unknown Source) [java] at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:388) [java] at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:416) [java] at com.sun.glass.ui.View.handleMouseEvent(View.java:555) [java] at com.sun.glass.ui.View.notifyMouse(View.java:937) [java] at com.sun.glass.ui.mac.MacView.notifyMouse(MacView.java:127)
22-04-2016

Suspect that this is a Glass full-screen issue rather than a media issue.
30-11-2015