-
Notifications
You must be signed in to change notification settings - Fork 473
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
Fix data race in SetCurrentConnection
#440
Conversation
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.
LGTM, thanks calvin.
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.
Thanks @calvinxiao , cool job. I add some comments, please have a look.
@git-hulk We should add memory and thread sanitizer to CI ASAP.
yeah |
Co-authored-by: Wang Yuan <wangyuancode@163.com>
Rebased, tests should pass. |
I found one data race using Thread Sanitizer.
SetCurrentConnection
was introduced by #363 , and it can only be used with exclusive commands.Fixed by moving
svr_->SetCurrentConnection(this);
after theExclusivityGuard
is acquired.Verified with these benchmark commands:
redis-benchmark -p 6666 -r 10000 -n 10000 eval 'return redis.call("ping")' 0
redis-benchmark -p 6666
Here is the Thread Sanitizer output: