pingcap / pingcap/tidb

"invalid transaction" when "use of closed network connection" happened

Open
#61,863 1 comment 0 reactions 0 assignees View on GitHub
affects-7.5 sig/sql-infra type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

This might be an ungraceful error handling rather than a serious problem

### 1. Minimal reproduce step (Required)

Unknown. Maybe disconnection or network partition

### 2. What did you expect to see? (Required)

No error logs like "txnManager failed to handle OnStmtRollback" or "invalid transaction"

### 3. What did you see instead (Required)
```

2025-06-05 16:02:39 | [2025/06/05 16:02:39.914 +00:00] [WARN] [session.go:964] ["commit failed"] [conn=4224894718] [session_alias=] ["finished txn"="Txn{state=invalid}"] [error="[kv:8024]invalid transaction"]
-- | --
  |   | 2025-06-05 16:02:39 | [2025/06/05 16:02:39.914 +00:00] [WARN] [session.go:1262] [sql] [conn=4224894718] [session_alias=] [label=general] [session="{\n \"currDBName\": \"xxxx\",\n \"id\": xxxxx,\n \"status\": 2,\n \"strictMode\": true,\n \"user\": {\n \"Username\": \"xxxxx\",\n \"Hostname\": \"some_ip\",\n \"CurrentUser\": false,\n \"AuthUsername\": \"xxxx\",\n \"AuthHostname\": \"%\",\n \"AuthPlugin\": \"mysql_native_password\"\n }\n}"] [error="[kv:8024]invalid transaction"]
  |   | 2025-06-05 16:02:39 | [2025/06/05 16:02:39.914 +00:00] [WARN] [server.go:943] ["error setting read deadline for kill."] [error="set tcp 172.16.0.160:4000: use of closed network connection"]
  |   | 2025-06-05 16:02:39 | [2025/06/05 16:02:39.914 +00:00] [WARN] [session.go:1246] ["transaction association"] [conn=4224894718] [session_alias=] ["retrying txnStartTS"=458526388151648344] ["original txnStartTS"=458526388086112320]
  |   | 2025-06-05 16:02:39 | [2025/06/05 16:02:39.914 +00:00] [ERROR] [txn.go:737] ["txnManager failed to handle OnStmtRollback"] [conn=4224894718] [session_alias=] [error="context provider not set"]
  |   | 2025-06-05 16:02:39 | [2025/06/05 16:02:39.914 +00:00] [WARN] [server.go:943] ["error setting read deadline for kill."] [error="set tcp 172.16.0.160:4000: use of closed network connection"]

```

### 4. What is your TiDB version? (Required)

v8.1.2, v7.5

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.