AreaChart / BubbleChart / BarChart / LineChart / ScatterChart / StackedAreaChart / StackedBarChart fail to initialize in a background thread when adding a series, throwing an exception when
binding to Platform.accessibilityActiveProperty().
To reproduce, use the newly developed NodeInitializationStressTest:
```
@Test
public void lineChart() {
test(() -> {
LineChart c = new LineChart(createNumberAxis("x"), createNumberAxis("y"));
c.getData().setAll(createNumberSeries());
return c;
}, (c) -> {
c.getData().setAll(createNumberSeries());
accessChart(c);
});
}
```
Exception (example):
java.lang.ArrayIndexOutOfBoundsException: Index 712 out of bounds for length 709
at javafx.base/com.sun.javafx.binding.ExpressionHelper$Generic.addListener(ExpressionHelper.java:248)
at javafx.base/com.sun.javafx.binding.ExpressionHelper$Generic.addListener(ExpressionHelper.java:1)
at javafx.base/com.sun.javafx.binding.ExpressionHelper.addListener(ExpressionHelper.java:65)
at javafx.base/javafx.beans.property.ReadOnlyBooleanPropertyBase.addListener(ReadOnlyBooleanPropertyBase.java:52)
at javafx.base/javafx.beans.property.BooleanPropertyBase.bind(BooleanPropertyBase.java:176)
at javafx.graphics/javafx.css.StyleableBooleanProperty.bind(StyleableBooleanProperty.java:96)
at javafx.controls/javafx.scene.chart.LineChart.createSymbol(LineChart.java:533)
at javafx.controls/javafx.scene.chart.LineChart.seriesAdded(LineChart.java:427)
at javafx.controls/javafx.scene.chart.XYChart.lambda$0(XYChart.java:166)
at javafx.base/com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(ListListenerHelper.java:162)
at javafx.base/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:71)
at javafx.base/javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:246)
at javafx.base/javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482)
at javafx.base/javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541)
at javafx.base/javafx.collections.ObservableListBase.endChange(ObservableListBase.java:210)
at javafx.base/javafx.collections.ModifiableObservableListBase.setAll(ModifiableObservableListBase.java:102)
at javafx.base/javafx.collections.ObservableListBase.setAll(ObservableListBase.java:264)
at test.robot.javafx.scene.NodeInitializationBackgroundThreadTest.lambda$27(NodeInitializationBackgroundThreadTest.java:305)
at test.robot.javafx.scene.NodeInitializationBackgroundThreadTest$1.run(NodeInitializationBackgroundThreadTest.java:481)
Root Cause:
(Multiple) properties are getting bound to the global Platform.accessibilityActive property. Binding (and I say, accessing) of properties is not thread-safe.
binding to Platform.accessibilityActiveProperty().
To reproduce, use the newly developed NodeInitializationStressTest:
```
@Test
public void lineChart() {
test(() -> {
LineChart c = new LineChart(createNumberAxis("x"), createNumberAxis("y"));
c.getData().setAll(createNumberSeries());
return c;
}, (c) -> {
c.getData().setAll(createNumberSeries());
accessChart(c);
});
}
```
Exception (example):
java.lang.ArrayIndexOutOfBoundsException: Index 712 out of bounds for length 709
at javafx.base/com.sun.javafx.binding.ExpressionHelper$Generic.addListener(ExpressionHelper.java:248)
at javafx.base/com.sun.javafx.binding.ExpressionHelper$Generic.addListener(ExpressionHelper.java:1)
at javafx.base/com.sun.javafx.binding.ExpressionHelper.addListener(ExpressionHelper.java:65)
at javafx.base/javafx.beans.property.ReadOnlyBooleanPropertyBase.addListener(ReadOnlyBooleanPropertyBase.java:52)
at javafx.base/javafx.beans.property.BooleanPropertyBase.bind(BooleanPropertyBase.java:176)
at javafx.graphics/javafx.css.StyleableBooleanProperty.bind(StyleableBooleanProperty.java:96)
at javafx.controls/javafx.scene.chart.LineChart.createSymbol(LineChart.java:533)
at javafx.controls/javafx.scene.chart.LineChart.seriesAdded(LineChart.java:427)
at javafx.controls/javafx.scene.chart.XYChart.lambda$0(XYChart.java:166)
at javafx.base/com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(ListListenerHelper.java:162)
at javafx.base/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:71)
at javafx.base/javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:246)
at javafx.base/javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482)
at javafx.base/javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541)
at javafx.base/javafx.collections.ObservableListBase.endChange(ObservableListBase.java:210)
at javafx.base/javafx.collections.ModifiableObservableListBase.setAll(ModifiableObservableListBase.java:102)
at javafx.base/javafx.collections.ObservableListBase.setAll(ObservableListBase.java:264)
at test.robot.javafx.scene.NodeInitializationBackgroundThreadTest.lambda$27(NodeInitializationBackgroundThreadTest.java:305)
at test.robot.javafx.scene.NodeInitializationBackgroundThreadTest$1.run(NodeInitializationBackgroundThreadTest.java:481)
Root Cause:
(Multiple) properties are getting bound to the global Platform.accessibilityActive property. Binding (and I say, accessing) of properties is not thread-safe.
- blocks
-
JDK-8348987 ☂ Thread safety in Node initialization
-
- In Progress
-
- duplicates
-
JDK-8349090 PieChart: exception initializing in a background thread
-
- Closed
-
- relates to
-
JDK-8351067 Enforce Platform threading use
-
- In Progress
-
-
JDK-8350976 MenuBarSkin: exception initializing in a background thread
-
- In Progress
-
- links to
-
Commit(master) openjdk/jfx/fc770fb9
-
Review(master) openjdk/jfx/1697
(1 links to)