Open
Description
go version 1.22.10
mysql version 8.0.32
go-mysql 1.9.1
When using the canal method to parse the binlog in real time, the following error occurs intermittently: "binlogstreamer.go:78 close sync with err: ERROR 4031 (HY000): The client was disconnected by the server because of inactivity. See wait_timeout and interactive_timeout for configuring this behavior." I wonder if it is necessary to set some additional parameters when connecting to MySQL?
Metadata
Metadata
Assignees
Labels
No labels
Activity
dveeden commentedon Jan 3, 2025
Any related entries in the MySQL logs? (with
log_error_verbosity=3
if possible, see also https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_log_error_verbosity )dveeden commentedon Jan 3, 2025
What settings have you set for
wait_timeout
andinteractive_timeout
? How often does this happen?imysm commentedon Jan 3, 2025
mysql param wait_timeout =3600 interactive_timeout=3000
Sometimes it occurs once every dozen days, and sometimes it occurs once every few days.
Does this require adjusting the MySQL settings? Or is it sufficient to add some parameters to the application client? Is it possible to enable auto - reconnection, or can we send heartbeats to prevent the connection from dropping?
lance6716 commentedon Jan 3, 2025
If your application can consume binlog within 3000 seconds, the connection will not be killed by MySQL server. Please check your logic if it's stuck.
dveeden commentedon Jan 3, 2025
Is the gap between binlog events always less than the timeout?
imysm commentedon Jan 3, 2025
My current solution is to use Supervisor to manage the process. When the program encounters an error, it will exit with code 1, and then Supervisor will automatically restart the program to achieve the purpose of continuously consuming the binlog. However, I can't find the reason for the ERROR 4031 (HY000) error.