Percona Ctradb 8.0 fake timout

Hi

I have a Percona xtradb 8.0 cluster where I’ve been testing db timeouts.

in my.cnf I have the following timeout settings where I set timeout to 900s:

[mysqld]
...
interactive_timeout=900
wait_timeout=900

more timeout settings

mysql> show variables like '%timeout%';
+-------------------------------------+----------+
| Variable_name                       | Value    |
+-------------------------------------+----------+
| connect_timeout                     | 10       |
| delayed_insert_timeout              | 300      |
| have_statement_timeout              | YES      |
| innodb_flush_log_at_timeout         | 1        |
| innodb_lock_wait_timeout            | 50       |
| innodb_print_lock_wait_timeout_info | OFF      |
| innodb_rollback_on_timeout          | OFF      |
| interactive_timeout                 | 900      |
| lock_wait_timeout                   | 31536000 |
| mysqlx_connect_timeout              | 30       |
| mysqlx_idle_worker_thread_timeout   | 60       |
| mysqlx_interactive_timeout          | 28800    |
| mysqlx_port_open_timeout            | 0        |
| mysqlx_read_timeout                 | 30       |
| mysqlx_wait_timeout                 | 28800    |
| mysqlx_write_timeout                | 60       |
| net_read_timeout                    | 30       |
| net_write_timeout                   | 60       |
| replica_net_timeout                 | 60       |
| rpl_stop_replica_timeout            | 31536000 |
| rpl_stop_slave_timeout              | 31536000 |
| slave_net_timeout                   | 60       |
| ssl_session_cache_timeout           | 300      |
| thread_pool_idle_timeout            | 60       |
| wait_timeout                        | 900      |
| wsrep_RSU_commit_timeout            | 5000     |
+-------------------------------------+----------+
26 rows in set (0.00 sec)

However I created a connection and let it rest for 15 + minutes I get the following error which seems to indicate that the connection was disabled , but the queries still gives results.

mysql> select 1 from dual;
ERROR 4031 (HY000): The client was disconnected by the server because of inactivity. See wait_timeout and interactive_timeout for configuring this behavior.
No connection. Trying to reconnect...
Connection id:    13175
Current database: *** NONE ***

+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.04 sec)

How can I resolve this and actually make idle db connections timeout after 15 minutes?

@crimson_pirate Yes, the connection was indeed terminated. However, the mysql client has auto-reconnection abilities. That’s what happened. The client was disconnected, and then it re-connected:

No connection. Trying to reconnect…

See? It tells you this. After it reconnected, the query was executed.

In your application code, you would have to implement auto reconnection on failure yourself. This auto reconnect is a feature of the CLI client.