-
Notifications
You must be signed in to change notification settings - Fork 472
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
SLAVEOF command may block a long time #1170
Comments
@caipengbo I think the root cause is we didn't set a timeout for the connect operation, so it will backoff retransmit the syn packet(1s,2s,4s,8s,16s,32s,64s) until reaching the |
Yes, we should add a timeout. |
Cool, got it. |
Let's set it a little longer than 3 seconds, so we can tolerate 2 times lost sync packages? @git-hulk |
Yes, sounds good to me. |
Search before asking
Version
2.2.0
Minimal reproduce step
echo 6 > /proc/sys/net/ipv4/tcp_syn_retries
SLAVEOF
a non-routable IP address(such as10.255.255.1
)SLAVEOF new_master_ip port
What did you expect to see?
Step 3 should not block for a long time because we are switching to the new master, which should be a quick operation.
What did you see instead?
Step 3 will block a long time(> 2min based on above reproduced scenario)
Anything Else?
This is because we use blocking IO when use socket connect(2). In some cases,
connect(2)
will be blocked for a long time.Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: