user27772
user27772

Reputation: 605

Entering text into JavaFX TextField freezes application

in our JavaFX application different customers get more or less sporadically the following error while entering text in TextField's. As a result, the rendering framework seems to run into an endless loop in which the error below is repeatedly printed into the System console. From there, the application freezes completely, must be killed and restarted which is a complete showstopper for those customers.

Threading issues (Fx and worker threads) are not involved in this place.

The bug occurs in Windows 7 and 10, Java 1.8.0_171, but as I remember it occured also with previous Java versions:

Exception in thread "JavaFX Application Thread"
java.lang.ArrayIndexOutOfBoundsException: -1
            at java.util.ArrayList.elementData(Unknown Source)
            at java.util.ArrayList.get(Unknown Source)
            at com.sun.javafx.collections.ObservableListWrapper.get(ObservableListWrapper.java:89)
            at com.sun.javafx.collections.VetoableListDecorator.get(VetoableListDecorator.java:306)
            at javafx.scene.Parent.updateCachedBounds(Parent.java:1591)
            at javafx.scene.Parent.recomputeBounds(Parent.java:1535)
            at javafx.scene.Parent.impl_computeGeomBounds(Parent.java:1388)
            at javafx.scene.layout.Region.impl_computeGeomBounds(Region.java:3078)
            at javafx.scene.Node.updateGeomBounds(Node.java:3579)
            at javafx.scene.Node.getGeomBounds(Node.java:3532)
            at javafx.scene.Node.computeLocalBounds(Node.java:3595)
            at javafx.scene.Node.updateLocalBounds(Node.java:3625)
            at javafx.scene.Node.getLocalBounds(Node.java:3486)
            at javafx.scene.Node.updateTxBounds(Node.java:3643)
            at javafx.scene.Node.getTransformedBounds(Node.java:3426)
            at javafx.scene.Node.updateBounds(Node.java:559)
            at javafx.scene.Parent.updateBounds(Parent.java:1719)
            at javafx.scene.Parent.updateBounds(Parent.java:1717)
            at javafx.scene.Parent.updateBounds(Parent.java:1717)
            at javafx.scene.Parent.updateBounds(Parent.java:1717)
            at javafx.scene.Parent.updateBounds(Parent.java:1717)
            at javafx.scene.Parent.updateBounds(Parent.java:1717)
            at javafx.scene.Parent.updateBounds(Parent.java:1717)
            at javafx.scene.Parent.updateBounds(Parent.java:1717)
            at javafx.scene.Parent.updateBounds(Parent.java:1717)
            at javafx.scene.Parent.updateBounds(Parent.java:1717)
            at javafx.scene.Parent.updateBounds(Parent.java:1717)
            at javafx.scene.Parent.updateBounds(Parent.java:1717)
            at javafx.scene.Parent.updateBounds(Parent.java:1717)
            at javafx.scene.Parent.updateBounds(Parent.java:1717)
            at javafx.scene.Parent.updateBounds(Parent.java:1717)
            at javafx.scene.Parent.updateBounds(Parent.java:1717)
            at javafx.scene.Parent.updateBounds(Parent.java:1717)
            at javafx.scene.Parent.updateBounds(Parent.java:1717)
            at javafx.scene.Parent.updateBounds(Parent.java:1717)
            at javafx.scene.Parent.updateBounds(Parent.java:1717)
            at javafx.scene.Parent.updateBounds(Parent.java:1717)
            at javafx.scene.Parent.updateBounds(Parent.java:1717)
            at javafx.scene.Parent.updateBounds(Parent.java:1717)
            at javafx.scene.Parent.updateBounds(Parent.java:1717)
            at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2404)
            at com.sun.javafx.tk.Toolkit.lambda$runPulse$29(Toolkit.java:398)
            at java.security.AccessController.doPrivileged(Native Method)
            at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:397)
            at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:424)
            at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:518)
            at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:498)
            at com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:491)
            at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$403(QuantumToolkit.java:319)
            at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
            at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
            at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
            at java.lang.Thread.run(Unknown Source)

For me it's clearly an programming error in Parent.java:1591 since remainingDirtyNodes seems to be not in sync with dirtyNodes list but no bounds check is done for dirtyNodes, causing the ArrayIndexOutOfBoundsException.

Is there any workaround for this?

Thanks, Peter

PS: Apart from this, JavaFX seems to run impressively stable and it is fun to work with.

Upvotes: 0

Views: 308

Answers (1)

Michael
Michael

Reputation: 44130

It's a bug, related to "removing a Node from the scene graph"

It's still without a fix, scheduled for release in Open JFX 11. I'm not sure when you can expect a release, as JavaFX is being split out from the JDK, and this issue has been open for two years already.

The ticket includes a minimal example, so probably the best you can hope for is to find a correlation in how you manipulate the scene graph and work around the issue.

See: https://bugs.openjdk.java.net/browse/JDK-8163078

Upvotes: 2

Related Questions