-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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-server does not shutdown gracefully if pd-server and/or tikv-server have gone away #10260
Comments
I'm mostly interested here in how tidb-server responds to signals (SIGTERM and SIGINT) that cause it to exit. There are other discussions that might happen about other graceful ways to tell tidb-server to exit (a "SHUTDOWN" SQL statement, for example, or something in tidb-ctl), and I guess those things should also bypass the retry loop(s) I refer to in this issue. |
I can reproduce this bug report against master. I tested this using two scenarios:
$ time mysql -e 'shutdown';
ERROR 9001 (HY000) at line 1: PD server timeout
real 1m20.690s
user 0m0.000s
sys 0m0.006s
$ ps aux | grep tidb-server
nullnot+ 1478541 0.6 0.0 2477328 78528 pts/0 Sl 16:37 0:02 ./bin/tidb-server --config=/mnt/evo970/etc/tidb.toml
nullnot+ 1479639 0.0 0.0 9032 2724 pts/7 S+ 16:43 0:00 grep --color=auto tidb-server
$ killall -9 pd-server tikv-server
$ killall tidb-server
$ killall tidb-server
$ ps aux | grep tidb-server
nullnot+ 1479747 0.0 0.0 9624 3812 pts/0 S+ 16:44 0:00 /bin/bash /home/nullnotnil/bin/old-make-full-tidb-server
nullnot+ 1479802 1.5 0.0 2404108 73648 pts/0 Sl+ 16:44 0:00 ./bin/tidb-server --config=/mnt/evo970/etc/tidb.toml
nullnot+ 1480077 0.0 0.0 9032 736 pts/7 S+ 16:45 0:00 grep --color=auto tidb-server My TiDB version: mysql> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v4.0.0-beta.2-762-g77aecd4b2
Edition: Community
Git Commit Hash: 77aecd4b27e79a97215eb4fdd68f68f2ddf67d21
Git Branch: master
UTC Build Time: 2020-07-13 01:43:31
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.00 sec) |
dup of #18336 |
Please check whether the issue should be labeled with 'affects-x.y' or 'fixes-x.y.z', and then remove 'needs-more-info' label. |
Bug Report
Please answer these questions before submitting your issue. Thanks!
What did you do?
When shutting down an entire cluster, tidb-server does not handle its own shutdown well if pd-server and/or tikv-server have already exited.
What did you expect to see?
tidb-server's signal handler should be able to override the loops to re-establish communication with pd and tikv.
Even after receiving sigterm, tidb-server runs for more than 60 seconds and outputs more than 2000 lines to the log.
tidb-server -V
or runselect tidb_version();
on TiDB)?The text was updated successfully, but these errors were encountered: