bquanhuang / bluecove

Automatically exported from code.google.com/p/bluecove
0 stars 0 forks source link

OS-X - Bluecove init not returning #27

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Sometimes, bluecove won't start and getLocalDevice();  will never return.

There is a race condition bug in OSXStack.mm

The method oneNativeThreadMain() must take and release theinitializeMutex lock 
(defined in 
JNI_OnLoad), before sending initializeCond, so that it is sure that JNI_OnLoad 
is actually waiting on 
it in pthread_cond_wait. (pthread_cond_wait also takes a mutex as a parameter, 
this mutex is 
released before waiting for the signal and retaken after getting it, thus 
before sending the signal, 
we must check if this lock is available).
Else, as it is today, under heavy load, it can happen that when JNI_OnLoad 
starts to wait for this 
condition, it has already been fired, and it will ignore it, and then we're in 
a dead lock.

Please find attached code with a fix proposal.

Original issue reported on code.google.com by heb...@gmail.com on 30 Jan 2008 at 7:24

Attachments:

GoogleCodeExporter commented 8 years ago
Bug reproduced, fixed and tested
The fixed version is bluecove-2.0.3 build 22 and later.

Original comment by skarzhev...@gmail.com on 30 Jan 2008 at 6:17

GoogleCodeExporter commented 8 years ago

Original comment by skarzhev...@gmail.com on 5 Feb 2008 at 3:03

GoogleCodeExporter commented 8 years ago

Original comment by skarzhev...@gmail.com on 5 Apr 2008 at 8:21

GoogleCodeExporter commented 8 years ago

Original comment by skarzhev...@gmail.com on 5 Sep 2008 at 7:16