Bug #105878 FEDERATED engine not reconnecting on wait_timeout exceeded
Submitted: 13 Dec 2021 13:32 Modified: 13 Dec 2021 15:30
Reporter: Sami Ahlroos Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server: Federated storage engine Severity:S3 (Non-critical)
Version:8.0.27 OS:Any
Assigned to: CPU Architecture:Any

[13 Dec 2021 13:32] Sami Ahlroos
Description:
When using Federated engine, if connection is closed on source server because wait_time is exceeded, client gets "Got packets out of order" error.

This happens on 8.0.24 and later, and not earlier. Possibly this is related to the more informative error message when connection is closed because of wait_timeout? Using "kill <id>;" on connections opened by Federated do not show this issue.

"Client" side of Federated shows no error in log, the server holding the table shows "The client was disconnected by the server because of inactivity".

How to repeat:
Set up two servers:
dbdeployer deploy multiple --nodes 2 8.0.25 --my-cnf-options federated --my-cnf-options log_error_verbosity=3

n2 -e "set global wait_timeout=5"
n2 -e "create table test.f (id int primary key); insert into test.f values(1)"

n1 -e "create server test foreign data wrapper test1 options (user 'msandbox', password 'msandbox', host '127.0.0.1', port 26729, database 'test');"
n1 -e "create table test.f (id int primary key) engine=federated connection='test';"

n1 -e "select * from test.f; select sleep(10); select * from test.f;"
+----+
| id |
+----+
|  1 |
+----+
+-----------+
| sleep(10) |
+-----------+
|         0 |
+-----------+
ERROR 1156 (08S01) at line 1: Got packets out of order
[15 Dec 2021 15:33] MySQL Verification Team
okay, but dbdeployer isn't in question here.  Can just do the setup manually.
Looks like the issue is FEDERATED doesn't keepalive/reconnect the dead connections?