Tidb: inactive connections should be closed after `wait_timeout`

Created on 9 Nov 2018  路  5Comments  路  Source: pingcap/tidb

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

componenserver statuTODO statuhelp-wanted

Most helpful comment

I will try to do this.

All 5 comments

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

Anyway, MySQL variable wait_timeout could be supported in TiDB.

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.

I will try to do this.

Support for wait_timeout has been added, so I am going to close this issue now. Support for interactive_timeout can be tracked in https://github.com/pingcap/tidb/issues/8487

Was this page helpful?
0 / 5 - 0 ratings