jwamp icon indicating copy to clipboard operation
jwamp copied to clipboard

The WaitResponse.java class has a race condition

Open chuckmarcotte opened this issue 10 years ago • 1 comments

The WaitResponse.java class has a race condition:

public synchronized T call() throws Exception { wait(waitfor);
return result; }

The result may already have arrived before the call() method is invokded. Proposed change:

public synchronized T call() throws Exception { if (this.result == null) { wait(waitfor); } return result; }

chuckmarcotte avatar Aug 04 '14 17:08 chuckmarcotte

The equivalent race in the messageoverhaul branch was in the Promise class, which I pushed a fix for yesterday (thank you for spotting that). Would you be willing to do your eval in the messageoverhaul branch? WaitResponse isn't going to be part of the library moving forward...

For a bit of history here, messageoverhaul is pretty much done (it was a major rewrite). I have gotten sidetracked with some business level things, but it will be eventually pushed back to HEAD.

trumpetinc avatar Aug 05 '14 23:08 trumpetinc