Skip to content
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

inactive connections should be closed after wait_timeout #8245

Closed
zz-jason opened this issue Nov 9, 2018 · 5 comments
Closed

inactive connections should be closed after wait_timeout #8245

zz-jason opened this issue Nov 9, 2018 · 5 comments
Labels
component/server help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.

Comments

@zz-jason
Copy link
Member

zz-jason commented Nov 9, 2018

Bug Report

Currently TiDB doesn't close a connection automatically, however if the client was down or something goes wrong, some connections are turned to be idle forever, which should be closed.

MySQL use the variable wait_timeout to define the number of seconds the server waits for activity on a non-interactive connection before closing it. We can follow this behavior as well.

For more detail, see: https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_wait_timeout

@zz-jason zz-jason added type/bug The issue is confirmed as a bug. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. component/server and removed help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Nov 9, 2018
@jackysp
Copy link
Member

jackysp commented Nov 9, 2018

When the client is down or something goes wrong, some connections will not turned to be idle forever, unless tcp-keep-alive = false
I've tested it manually when tcp-keep-alive = true

  1. start 1000 sysbench threads to bench the TiDB
  2. kill -9 sysbench before the test finish
  3. check the connection number in the grafana

image

@jackysp jackysp added status/TODO and removed type/bug The issue is confirmed as a bug. labels Nov 9, 2018
@jackysp
Copy link
Member

jackysp commented Nov 9, 2018

Anyway, MySQL variable wait_timeout could be supported in TiDB.

@jackysp jackysp added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Nov 9, 2018
@morgo
Copy link
Contributor

morgo commented Nov 9, 2018

For MySQL compatibility, there are actually two settings: wait_timeout and interactive_timeout.

Interactive applies to command line clients etc. Anything that sets the interactive 'bit' in the client protocol.

@hhu-cc
Copy link
Contributor

hhu-cc commented Nov 15, 2018

I will try to do this.

@morgo
Copy link
Contributor

morgo commented Dec 6, 2018

Support for wait_timeout has been added, so I am going to close this issue now. Support for interactive_timeout can be tracked in #8487

@morgo morgo closed this as completed Dec 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/server help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
Projects
None yet
Development

No branches or pull requests

4 participants