Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
There are three issues in the c code of lock.
1, It not multi-thread safe, because pmutex is the local mutex of zkr_lock_mutex_t, if there are more than one thread is calling zkr_lock_lock, it may watch children node fail(retry_zoowexists may return NOT ZOK, 'unable to watch my predecessor' will output. I suggest that changing the pmutex to global.
2,child_floor function is not correct, it should compare the sequence of the node.(zoo_lock.c, line145 should be 'if (strcmp((sorted_data[i] + 19), (element + 19)) < 0)'
3, Logic mistaking in zkr_lock_operation of zoo_lock.c at line 256. mutex->id should be allocated by getName function. So, I think that we should delete from line 249 to 257.