From c46c34c033955b022c7aa57590d7bda41e54c6be Mon Sep 17 00:00:00 2001 From: David Fokkema Date: Sat, 19 Apr 2014 10:09:10 +0200 Subject: [PATCH] Another 'fix': added a timeout before vm.resume() I think we have a race condition: vm.resume() is called *before* the VM is actually ready to resume. That is strange, since the debugger is attached, eventQueues are set up and ready... Still, waiting for a bit ensures that the VM actually resumes. This behavior was not present when Java 1.6 was still used. Is this a bug in Java 1.7? Or is it simply that the VM in 1.6 started up quickly enough to hide the race condition? I'll continue looking... --- app/src/processing/mode/java/runner/Runner.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/processing/mode/java/runner/Runner.java b/app/src/processing/mode/java/runner/Runner.java index 9bea617b5..dbee59be1 100644 --- a/app/src/processing/mode/java/runner/Runner.java +++ b/app/src/processing/mode/java/runner/Runner.java @@ -710,6 +710,12 @@ public class Runner implements MessageConsumer { errThread.start(); outThread.start(); + try { + Thread.sleep(1000); + } catch(InterruptedException ex) { + Thread.currentThread().interrupt(); + } + vm.resume(); // Shutdown begins when event thread terminates