JDK-8163078 ArrayIndexOutOfBounds is thrown in Parent.updateCachedBounds

Stefan Fuchs snfuchs at gmx.de
Thu Nov 10 19:17:32 UTC 2016


Hi Daniel,

I mentioned it, because we got similar exceptions in our application, 
which stalled our application completely
We moved the add of the listeners around.
Luckily we could move most of the code,which added or removed listeners, 
to the application startup code.
So the problem went away.

As of JDK-8163078 I wonder, if the code below is correct, given that 
https://docs.oracle.com/javase/8/javafx/api/javafx/scene/Node.html#layoutBoundsProperty 
says:

...
"Because the computation of layoutBounds is often tied to a node's 
geometric variables, it is an error to bind any such variables to an 
expression that depends upon |layoutBounds|. For example, the x or y 
variables of a shape should never be bound to layoutBounds for the 
purpose of positioning the node. "



         DoubleBinding innerWidth = 
javafx.beans.binding.Bindings.createDoubleBinding(
                 () -> g.layoutBoundsProperty().get().getWidth(),
                 g.layoutBoundsProperty());
         l.endXProperty().bind(innerWidth);


-- Stefan
> Hi Stefan,
>
> >From code review it seems that this is not the case. I'll ask my team mate to check this programmatically just to make sure...
>
> Note that JDK-8163078 contains a code example which reproduces the exception but adds and removes listeners on the JavaFX thread.
>
> Kind regards,
> Daniel
>
>> -----Original Message-----
>> From: Stefan Fuchs [mailto:snfuchs at gmx.de]
>> Sent: Wednesday, November 09, 2016 7:59 PM
>> To: Daniel Glöckner; openjfx-dev at openjdk.java.net
>> Subject: Re: JDK-8163078 ArrayIndexOutOfBounds is thrown in
>> Parent.updateCachedBounds
>>
>> Hi Daniel,
>>
>> are you registering or removing the listeners on  a thread other than the
>> JavaFX Application Thread?
>> I think the Observables are not thread save.
>>
>>
>> -- regards
>>    Stefan
>>
>>> Hi guys,
>>>
>>> We're facing an exception triggered from Parent.updateCachedBounds. I've
>> pasted the stack trace below.
>>> This looks very similar to https://bugs.openjdk.java.net/browse/JDK-
>> 8163078.
>>> We have a few listeners to layoutBounds property, similar to the reporter of
>> that issue. This seems to trigger the issue.
>>> For us it's hard to reproduce this issue in our application. If the bug shows
>> up the result is quite disastrous though. The application freezes in this case.
>>> Has anyone observed this bug or is aware of a workaround? P4 suggests that
>> it's a low priority issue with minor loss of functionality... really?
>>> Kind regards,
>>> Daniel
>>>
>>>    ERROR [28.10.16 13:01:45.415] DefaultLogger uncaughtException()
>>> 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(ObservableListWrappe
>> r.java:89)
>>> 	at
>> com.sun.javafx.collections.VetoableListDecorator.get(VetoableListDecorator.ja
>> va: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.getLocalBounds(Node.java:3480)
>>> 	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.Scene$ScenePulseListener.pulse(Scene.java:2404)
>>> 	at com.sun.javafx.tk.Toolkit.lambda$runPulse$30(Toolkit.java:355)
>>> 	at java.security.AccessController.doPrivileged(Native Method)
>>> 	at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:354)
>>> 	at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:381)
>>> 	at
>> com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:510)
>>> 	at
>> com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:490)
>>> 	at
>> com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$404(Quantum
>> Toolkit.java:319)
>>> 	at
>> com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.jav
>> a:95)
>>> 	at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
>>> 	at
>> com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:19
>> 1)
>>> 	at java.lang.Thread.run(Unknown Source)
>>>
>



More information about the openjfx-dev mailing list