Program Error: Lost Connection to MySQL Server

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 程序报错:lost connection to mysql server

| username: seiang

[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version] v5.0.3
[Reproduction Path] Operations performed that led to the issue
[Encountered Issue: Issue Phenomenon and Impact]
[Resource Configuration] Navigate to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachments: Screenshots/Logs/Monitoring]
Around 2023-12-13 00:53:00, the business program experienced a connection drop with the error “lost connection to mysql server,” as shown below:

Checking the TiDB node logs at 2023-12-13 00:53:00, there were many error messages, as shown below:

Note: None of the nodes were restarted.

This issue also occurred once some time ago. Experts, please help analyze it.

From the monitoring, the CPU suddenly dropped around 00:00.
image

| username: tidb狂热爱好者 | Original post link

Need assistance from an expert.

| username: WalterWj | Original post link

If it doesn’t work, just disable async commit.

| username: seiang | Original post link

The async commit is controlled by the parameter tidb_enable_async_commit, right? But why can’t I find this parameter?

| username: seiang | Original post link

Another issue is that when async commit fails, why does the client error show “lost connection to MySQL server”?

| username: seiang | Original post link

You can check it by using select @@tidb_enable_async_commit;.

| username: WalterWj | Original post link

Oh, I suspect it might be a bug with async commit :thinking:. Maybe try upgrading. Or try disabling this feature.
Mainly based on the log speculation…

| username: seiang | Original post link

I tried to disable async commit, but according to the monitoring, there are still some Async Commit Transactions.

What additional information is needed to pinpoint the exact cause?

| username: WalterWj | Original post link

:thinking: It seems that downgrading is not supported yet…

How about considering upgrading to version 5.0.6? Minor version upgrades are generally quite safe.

| username: WalterWj | Original post link

I see that version 5.0.4 has fixed a similar async commit bug. Check if the issue exhibits the same behavior. :thinking:

| username: seiang | Original post link

The phenomenon seems to be somewhat different.

| username: TIDB-Learner | Original post link

Based on the literal understanding of this error, the connection to the server was interrupted. The reason might be that the query volume was too large, leading to a timeout and interruption. Besides tracing the corresponding script and optimizing the statements, you can also adjust the relevant timeout settings, such as connection timeout, query timeout, and execution timeout.

| username: dba远航 | Original post link

It feels like the system synchronization time point has been reset to zero.

| username: seiang | Original post link

Do you mean the time point of the system’s NTP time synchronization?