Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Regression] GridPane crashes (@1kHz update rates) - FIXED #40

Closed
ennerf opened this issue Sep 19, 2019 · 10 comments
Closed

[Regression] GridPane crashes (@1kHz update rates) - FIXED #40

ennerf opened this issue Sep 19, 2019 · 10 comments
Assignees

Comments

@ennerf
Copy link
Collaborator

ennerf commented Sep 19, 2019

I tried to do a few long-running tests with live-charts at 1KHz and noticed that the latest dev version keeps crashing after 1-2 hours. I did some 24h+ tests last week, so this must be a recent regression.

I've tried a few different versions and it looks like this was introduced in minor: made drawing of grid on top/bottom CSS more easily configurable (4d8ebc3)

The full error is below. The application still runs, but the stage with the chart needs to be closed.

Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
	at javafx.graphics/javafx.scene.layout.GridPane.growToMultiSpanPreferredWidths(Unknown Source)
	at javafx.graphics/javafx.scene.layout.GridPane.adjustColumnWidths(Unknown Source)
	at javafx.graphics/javafx.scene.layout.GridPane.computeWidthsToFit(Unknown Source)
	at javafx.graphics/javafx.scene.layout.GridPane.computeMinHeight(Unknown Source)
	at javafx.graphics/javafx.scene.Parent.minHeight(Unknown Source)
	at javafx.graphics/javafx.scene.layout.Region.minHeight(Unknown Source)
	at javafx.graphics/javafx.scene.layout.Region.boundedNodeSizeWithBias(Unknown Source)
	at javafx.graphics/javafx.scene.layout.Region.layoutInArea(Unknown Source)
	at javafx.graphics/javafx.scene.layout.Region.layoutInArea(Unknown Source)
	at javafx.graphics/javafx.scene.layout.Region.layoutInArea(Unknown Source)
	at javafx.graphics/javafx.scene.layout.StackPane.layoutChildren(Unknown Source)
	at javafx.graphics/javafx.scene.Parent.layout(Unknown Source)
	at javafx.graphics/javafx.scene.Parent.layout(Unknown Source)
	at javafx.graphics/javafx.scene.Parent.layout(Unknown Source)
	at javafx.graphics/javafx.scene.Parent.layout(Unknown Source)
	at de.gsi.chart.ui.HiddenSidesPane.resizeRelocate(HiddenSidesPane.java:252)
	at javafx.graphics/javafx.scene.layout.AnchorPane.layoutChildren(Unknown Source)
	at javafx.graphics/javafx.scene.Parent.layout(Unknown Source)
	at javafx.graphics/javafx.scene.Scene.doLayoutPass(Unknown Source)
	at javafx.graphics/javafx.scene.Scene$ScenePulseListener.pulse(Unknown Source)
	at javafx.graphics/com.sun.javafx.tk.Toolkit.lambda$runPulse$2(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at javafx.graphics/com.sun.javafx.tk.Toolkit.runPulse(Unknown Source)
	at javafx.graphics/com.sun.javafx.tk.Toolkit.firePulse(Unknown Source)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(Unknown Source)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(Unknown Source)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(Unknown Source)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$11(Unknown Source)
	at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
	at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
	at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
@ennerf
Copy link
Collaborator Author

ennerf commented Sep 19, 2019

In this case the charts were drawn without a grid, and the only CSS styling was dataSet.setStyle(...)

Edit: tested on OpenJDK 13 + OpenJFX 13 and OpenJDK12 + OpenJFX 12.0.2

@ennerf
Copy link
Collaborator Author

ennerf commented Sep 19, 2019

Damn, 6bb9276 failed as well. I'm not sure what to try next.

@ennerf
Copy link
Collaborator Author

ennerf commented Sep 20, 2019

This may be a Linux-only issue. I couldn't reproduce it on Windows yet.

@RalphSteinhagen RalphSteinhagen changed the title [Regression] GridPane crashes [Regression] GridPane crashes (@1kHz update rates) Sep 20, 2019
@RalphSteinhagen
Copy link
Member

Tried to reproduce, unfortunately, as of now (~11h), cannot reproduce this feature.

We started another long-term test over the weekend using the RollingBufferSample, RollingBufferSortedTreeSample, and some other additional samples.

I noticed that you use a different JDK/OpenJFX version. If this isn't too much trouble, could you test your observation with JDK11 and OpenJFX 12.0.2?

Will keep my first test running until tomorrow morning and then start ramping up to 1 kHz notification rates. Could you send me your parameters (ie. number of samples, traces/datasets, line/marker configurations, fixed/auto-size of chart, etc.) so we can setup a test case. Alternatively, you may send in also a MVE. 😃

N.B. I updated the issue title since this seems to be specific for 1kHz update rates which we haven't tackled (until now). The usual chart update rates we test are 25, seldom 50 and max 100 Hz.

@RalphSteinhagen
Copy link
Member

sorry, saw your "Linux" comment only now. Could you try to periodically call the garbage collector (e.g. calling System.gc() twice @0.2 .. 0.5 Hz)? We noticed that the JVM has sometimes hick-ups if it has to do too deal with too much garbage collection at once. Alternatively, one could also temporarily reduce the maximum available memory of the JVM to force more frequent garbage collections -- just for testing/checking if it is GC-related.

@ennerf
Copy link
Collaborator Author

ennerf commented Sep 24, 2019

Sorry, I've been pretty busy with other things. I'll try to get back to you soon. I haven't seen anything out of the ordinary in flight recorder and the gc logs, but I'll give it a try.

@RalphSteinhagen
Copy link
Member

We did some longer running tests (>3 days) with no success... next time it crashes, could you provide a thread dump (e.g. using VisualVM)

Will try to write a test example with 1 kHz update: Could you provide me with your boundary parameters: numbers of samples, traces, markers on/off, renderer and/or renderer style: error bars/surface/none, chart dimensions etc.

Thanks in advance.

@RalphSteinhagen RalphSteinhagen self-assigned this Sep 25, 2019
RalphSteinhagen added a commit that referenced this issue Sep 29, 2019
changed auto-notification interface to AtomicBoolean and removed
superfluous setAutoNotification(boolean) interface to check for lock
race-conditions

added FX UI thread guards (didn't find anything this time, but just to
be safe for the future)

notably added additional writeLockGuard around auto-notification guard
-> should fix issue #40
@RalphSteinhagen
Copy link
Member

@ennerf could you check your issue against dev?

I exchanged the existing auto-notification suppression guard with an additional write lock guard around the recomputeLimits(..) (N.B. also by itself write lock protected) in XYChart:
https://github.com/GSI-CS-CO/chart-fx/blob/425a8ea024bbcd4cbf14106d7dc6febd0ec9622c/chartfx-chart/src/main/java/de/gsi/chart/XYChart.java#L250-L256

The modifications checks out against the new 1 kHz test and I hope so does your use-case.

Let us know if this still causes troubles.

The JavaFX UI thread wasn't really designed for 1 kHz update rate, even less having thread safety in mind. Nevertheless, we hope that chart-fx's DataSet, plugins and rendering infrastructure are reasonably thread-safe now.

N.B. the TableViewer plugin has a known thread-safety issue for >100 Hz updates rates but this seems to be related to the underlying JavaFX issue TableCellSkin.java:97.

@ennerf
Copy link
Collaborator Author

ennerf commented Oct 1, 2019

Thanks, it looks good so far. I'll let it run overnight.

@ennerf
Copy link
Collaborator Author

ennerf commented Oct 2, 2019

Ran it for 20 hours. Seems to work. Closing.

thanks!

@ennerf ennerf closed this as completed Oct 2, 2019
@RalphSteinhagen RalphSteinhagen changed the title [Regression] GridPane crashes (@1kHz update rates) [Regression] GridPane crashes (@1kHz update rates) - FIXED Oct 3, 2019
wirew0rm pushed a commit that referenced this issue Nov 8, 2019
changed auto-notification interface to AtomicBoolean and removed
superfluous setAutoNotification(boolean) interface to check for lock
race-conditions

added FX UI thread guards (didn't find anything this time, but just to
be safe for the future)

notably added additional writeLockGuard around auto-notification guard
-> should fix issue #40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants