-
Notifications
You must be signed in to change notification settings - Fork 7.3k
ZOOKEEPER-4299: Use lock free subroutines for clist in zoo_amulti since it is not multithreaded #2256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
/* initialize mutex and condition variable in clist */ | ||
clist.head = NULL; | ||
clist.last = NULL; | ||
#ifdef THREADED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked code related to zoo_amulti
and did not find concurrent usage of this list. The list is constructed in zoo_amulti
and deconstructed in deserialize_multi
. I would recommend to use queue_completion_nolock
and dequeue_completion_nolock
in these two places. Regarding the fix, the inited mutex/cond will leak as they are not destroyed.
@kezhuw https://github.com/apache/zookeeper/blob/master/zookeeper-client/zookeeper-client-c/src/mt_adaptor.c#L63 Please take a look at this code. Mutex lock is already being called without proper initialization. This will lead to EINVAL error at some point in the future. Do you recommend restructuring this code to remove the mutex and condition variable from completion_head_t? |
No.
This is what I recommend. To be specific, I mean those two places:
|
@kezhuw there is no dequeue_completion_nolock(). |
@Gowrima You could write one. |
|
No description provided.