JDK-8090205 : IllegalStateException while using com.sun.javafx.scene.web.Debugger
  • Type: Bug
  • Component: javafx
  • Sub-Component: web
  • Affected Version: 8u20
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2014-10-07
  • Updated: 2016-06-29
  • Resolved: 2016-06-29
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 9
9Resolved
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
When setting a breakpoint in a member method javafx webkit causes an error. See http://snag.gy/nQMks.jpg for where it fails but also where it works fine. In jdk8 before 8u20 this does work.
I think the issue is this flag added in commit which appeared in the last 8u20 - 
http://cr.openjdk.java.net/~msladecek/rt-36256/webrev/modules/graphics/src/main/java/com/sun/javafx/tk/quantum/QuantumToolkit.java.udiff.html
After adding the following *inPulse* flag, debugger API stop working when the breakpoint is set inside the function which is declared as a member of an object. I guess when the function is declared that way it also requires nested event loops, which is not handled in the patch.

Stack trace: 
{code}
java.lang.IllegalStateException: Nested event loops are allowed only while handling system events
	at com.sun.javafx.tk.quantum.QuantumToolkit.enterNestedEventLoop(QuantumToolkit.java:506)
	at com.sun.javafx.webkit.EventLoopImpl.cycle(EventLoopImpl.java:59)
	at com.sun.webkit.EventLoop.fwkCycle(EventLoop.java:45)
	at com.sun.webkit.Timer.twkFireTimerEvent(Native Method)
	at com.sun.webkit.Timer.fireTimerEvent(Timer.java:83)
	at com.sun.webkit.Timer.notifyTick(Timer.java:64)
	at javafx.scene.web.WebEngine$PulseTimer.lambda$static$44(WebEngine.java:1167)
	at javafx.scene.web.WebEngine$PulseTimer$$Lambda$67/10449826.pulse(Unknown Source)
	at com.sun.javafx.tk.Toolkit.lambda$runPulse$28(Toolkit.java:314)
	at com.sun.javafx.tk.Toolkit$$Lambda$134/26908315.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:313)
	at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:340)
	at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:451)
	at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:431)
	at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$363(QuantumToolkit.java:298)
	at com.sun.javafx.tk.quantum.QuantumToolkit$$Lambda$40/33541029.run(Unknown Source)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2549)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
{code}
Comments
Based on the call stack, closing this issue as duplicate of JDK-8160400.
29-06-2016

Based on the stack trace, this will almost certainly be fixed by the fix for JDK-8160400 so we will likely close this bug as a duplicate of that one.
28-06-2016

[comment from the original bug reporter on 12/2/2016] "I would say that for me (as a JBoss Tools developer who uses JavaFx for cordova ripple based mobile emulator) the regression JDK-8090205 is utterly important. Basically, it makes Debugger API unusable since 8u20"
02-12-2015

upgraded to P3 as regression labeled, if this is mistakenly labeled - then please remove the label and downgrade back
13-10-2015

That exception was intentionally added to fix RT-36256 so, no, we aren't going to remove it. I am not aware of a workaround.
11-05-2015

hey, guys facing the same issue with 8u60 and 9. is it possible not to throw "java.lang.IllegalStateException: Nested event loops are allowed only while handling system events" for Debugger ? this code makes debugger API totally unuseable - : {code} if (inPulse) { throw new IllegalStateException("Nested event loops are allowed only while handling system events"); } {code} Can we somehow workaround it?
11-05-2015

hey, we produced the same error while using the WebEngine to print out html documents using the loadContent method. The error was first noticed by us in 8u25. Possible workaround in our scenario was to load the document via the WebEngine.load() method.
16-12-2014

hey, Janek Actually I load the content via WebEngine.load(), so this doesn't seem to be a workaround at this point. The main problem is that "inPulse" flag ignores the case when js function is declared as a member of an object.
16-12-2014

It is unlikely at this point, since we are almost out of time for 8u40 and have more urgent issues to address. If a safe fix can be found there is a small chance.
14-11-2014

Kevin Rushforth, no chance to see a fix in 8u40?
14-11-2014

Pulling it back into 8u40 since it is a regression.
07-10-2014

Yes, although we might pull it into 8u40 if the fix is simple and safe enough. I just tagged it as a regression (which it is) meaning that we are more likely to address it.
07-10-2014

Kevin Rushforth, does *Fix Version/s: 9* mean that we will have that functionality broken with JDK 8u40 and above ?
07-10-2014

Lowering to P4 since this is limited in scope and only happens when setting a developer debug property. Note that the com.sun.javafx.scene.web.Debugger system property is neither public API nor is it supported. This might be as easy as just allowing the nested event look in this case, but we would need to ensure that the lack of pulses being generated in this case (which is why the change for RT-36256 was done) is not going to cause other issues.
07-10-2014

https://issues.jboss.org/browse/JBIDE-18526 is where this was found with more specific details on when it happens.
07-10-2014