Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: ERROR 2013 (HY000): Lost connection to MySQL server during query
Error: ERROR 2013 (HY000): Lost connection to MySQL server during query
Configuration: set max_execution_time = 0; set tidb_mem_quota_query = 0;
tidb.log error: [expensivequery.go:178] [expensive_query] [cost_time=60.058973402s]
Are there any other parameters that need to be adjusted? The machine still has 60% of memory unused.
Check if the client has set a timeout.
Try setting the database read timeout to a longer duration.
Check this document for specific parameter descriptions: set global tidb_mem_quota_query. You can modify it by using set global var_name = value
.
There is no timeout issue with command line operations.
The version only supports session, and the session is already set to unlimited in the picture.
Is there a restart or a panic match in the logs for TiDB?
The image you provided is not visible. Please provide the text you need translated.
You’re upgrading from version 4 to 6.5.0, right?
The image is not visible. Please provide the text you need translated.
There are no panic characters matched in the tidb.log.
I know, if it’s not a clear bug, who would want to touch the production environment?
net_read_timeout? Can you provide a detailed parameter?
Did TiDB restart during this period?
Judging by this performance, it seems like the read timeout is too short. Check if there are any logs, otherwise, it’s hard to know where to start.
Where can I match the keywords?
It seems to be an OOM issue. Check the startup times of each component.
How does a lost connection relate to OOM (Out of Memory)?
I remember encountering this issue. When the TiDB server OOM restarts, the client will report this error.