Closed cal-pratt closed 7 years ago
Okay I solved it, but the answer still makes me scratch my head. Apparently the JavaFX thread is not to happy with the way the timeout observable is constructed:
final Observable<Boolean> timeout = Observable.just(false)
.delay(maxHeartbeatGap, TimeUnit.SECONDS, JAVA_FX_SCHEDULER)
.concatWith(Observable.never())
.takeUntil(heartbeats)
.repeat();
This observable alone seems to cause the issue, even if its only subscribed by a System.out.println
call. I have no idea what funkiness is going on inside the JavaFX scheduler , but replacing it with a Schedulers.newThread()
makes this problem go away. I think this might be a bug within the JavaFX code itself; works on one scheduler it should be fine on them all?
I don't have time to figure this out fully, but its worth remembering for the future. PR to follow shortly
I've managed to pin point a null pointer exception that pops up on the topsides sometimes. Code to reproduce this exception:
I can then cause the exception by emitting a lot of heartbeats on a different computer:
This causes the exception:
Now, I have no idea why this would be causing the NPE as the operation is performed on the JavaFX thread seeing as each action happen on
observeOn(JAVA_FX_SCHEDULER)
:Maybe the speed of updating the FX components can cause issues? But that's also strange because I can update the imageview at fairly fast rates. Will investigate more