FULL PRODUCT VERSION :
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux oasisdev 2.6.32-504.8.1.el6.x86_64 #1 SMP Wed Jan 28 21:11:36 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Gets this:
Exception in thread "JavaFX Application Thread" java.lang.ArrayIndexOutOfBoundsException: 7
at com.sun.scenario.animation.AbstractMasterTimer.timePulseImpl(AbstractMasterTimer.java:344)
and looking at the code:
final PulseReceiver receiversSnapshot[] = receivers;
final int rLength = receiversLength;
try {
receiversLocked = true;
for (int i = 0; i < rLength; i++) {
344: receiversSnapshot[i].timePulse(TickCalculation.fromNano(now));
}
} finally {
receiversLocked = false;
}
There is a small amount of time that receiversSnapshot[] could be changed before it is locked at line 342 and apparently it is being changed occasionally.
At first it sometimes throws:
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
at com.sun.scenario.animation.AbstractMasterTimer.timePulseImpl(AbstractMasterTimer.java:344)
Possibly the receiver is null?
The runnables are created by a lambda:
runLater(() -> {
// do some javafx stuff here
}
public static void runInPlatform(Runnable runnable) {
Platform.runLater(() -> {
final AnimationTimer timer = new AnimationTimer() {
private int pulseCounter;
@Override
public void handle(long now) {
pulseCounter += 1;
if (pulseCounter > 2) {
stop();
runnable.run();
}
}
};
timer.start();
});
}
public static void runLater(Runnable runnable) {
final PauseTransition pt = new PauseTransition();
pt.setDuration(Duration.millis(500));
pt.setOnFinished(actionEvent -> runInPlatform(runnable::run));
pt.play();
}
ADDITIONAL REGRESSION INFORMATION:
JDK-8125818 looks like it may be the same issue (different version).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Start a lot animation timers. I started about 9 of them in particular caused an exception to be thrown by one and while sometimes the exception would bubble up occasionally this ArraryIndexOutOfBounds in timePulseImpl would kick off and then I had to stop the process to recover.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expected the underlying code to know the correct length of the array it was accessing.
ACTUAL -
The underlying code didn't know the correct length of the array it was accessing.
REPRODUCIBILITY :
This bug can be reproduced occasionally.
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux oasisdev 2.6.32-504.8.1.el6.x86_64 #1 SMP Wed Jan 28 21:11:36 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Gets this:
Exception in thread "JavaFX Application Thread" java.lang.ArrayIndexOutOfBoundsException: 7
at com.sun.scenario.animation.AbstractMasterTimer.timePulseImpl(AbstractMasterTimer.java:344)
and looking at the code:
final PulseReceiver receiversSnapshot[] = receivers;
final int rLength = receiversLength;
try {
receiversLocked = true;
for (int i = 0; i < rLength; i++) {
344: receiversSnapshot[i].timePulse(TickCalculation.fromNano(now));
}
} finally {
receiversLocked = false;
}
There is a small amount of time that receiversSnapshot[] could be changed before it is locked at line 342 and apparently it is being changed occasionally.
At first it sometimes throws:
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
at com.sun.scenario.animation.AbstractMasterTimer.timePulseImpl(AbstractMasterTimer.java:344)
Possibly the receiver is null?
The runnables are created by a lambda:
runLater(() -> {
// do some javafx stuff here
}
public static void runInPlatform(Runnable runnable) {
Platform.runLater(() -> {
final AnimationTimer timer = new AnimationTimer() {
private int pulseCounter;
@Override
public void handle(long now) {
pulseCounter += 1;
if (pulseCounter > 2) {
stop();
runnable.run();
}
}
};
timer.start();
});
}
public static void runLater(Runnable runnable) {
final PauseTransition pt = new PauseTransition();
pt.setDuration(Duration.millis(500));
pt.setOnFinished(actionEvent -> runInPlatform(runnable::run));
pt.play();
}
ADDITIONAL REGRESSION INFORMATION:
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Start a lot animation timers. I started about 9 of them in particular caused an exception to be thrown by one and while sometimes the exception would bubble up occasionally this ArraryIndexOutOfBounds in timePulseImpl would kick off and then I had to stop the process to recover.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expected the underlying code to know the correct length of the array it was accessing.
ACTUAL -
The underlying code didn't know the correct length of the array it was accessing.
REPRODUCIBILITY :
This bug can be reproduced occasionally.