-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
tidb panic at graceful shutdown #36793
Comments
found another race that may also cause this panic
|
Looked into the gracefully shutdown logic again and found there are a few defects in the current implement:
@xhebox @tiancaiamao I'm not sure what is the best way to deal with this, what do you think? |
For now, I think checking for nil pointers to prevent panic is the best solution. A better code structure needs big refactors. |
The panic is caused by |
Maybe make it |
KILL statement shared the same issue. |
IMO for the case listed in this issue and #48224, it has been fixed by #32111.
Yes However,
This is not covered by #32111, but I would say that this is generally fine since:
But for further enhancement, we cloud still try to make @july2993 @tiancaiamao @glorv @xhebox WDYT? |
@bb7133 not all LB are SQL aware, so it might not be possible to drain connections gracefully from LB side, so we have to drive it from server (tidb) side to close connections when they are idle and not allow to open new connections, so over time we drain as many connections gracefully as possible. |
Close by #49073 |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
use
systemctl stop tidb-4000
to stop a tidb-server during a sysbench test2. What did you expect to see? (Required)
TiDB should stop gracefully
3. What did you see instead (Required)
There is a panic with following stacktrace:
I think the root cause is that
clientconn.Close
is called twice at:tidb/server/server.go
Lines 539 to 542 in 34d877a
and
tidb/server/server.go
Lines 792 to 809 in 34d877a
4. What is your TiDB version? (Required)
nightly
The text was updated successfully, but these errors were encountered: