DXF DDL goroutine leak
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
a TiKV store is abnormal (it's a mock store, didn't implement write&ingest RPC 😉. But I think it does not matter) so I canceled DDL
### 2. What did you expect to see? (Required)
no leak
### 3. What did you see instead (Required)
no DDL job is running
```
mysql> admin show ddl jobs;
+--------+---------+-------------------------+---------------+--------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+---------------+-------------+
| JOB_ID | DB_NAME | TABLE_NAME | JOB_TYPE | SCHEMA_STATE | SCHEMA_ID | TABLE_ID | ROW_COUNT | CREATE_TIME | START_TIME | END_TIME | STATE | COMMENTS |
+--------+---------+-------------------------+---------------+--------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+---------------+-------------+
| 112 | test | t | add index | none | 2 | 110 | 400 | 2025-08-06 10:47:52.784000 | 2025-08-06 10:47:52.834000 | 2025-08-06 10:50:13.584000 | rollback done | ingest, DXF |
| 111 | test | t | create table | public | 2 | 110 | 0 | 2025-08-06 10:42:25.585000 | 2025-08-06 10:42:25.585000 | 2025-08-06 10:42:25.684000 | synced | |
| 109 | mysql | tidb_kernel_options | create table | public | 1 | 108 | 0 | 2025-08-06 10:41:20.885000 | 2025-08-06 10:41:20.934000 | 2025-08-06 10:41:20.984000 | synced | |
| 107 | mysql | index_advisor_results | create table | public | 1 | 106 | 0 | 2025-08-06 10:41:20.784000 | 2025-08-06 10:41:20.784000 | 2025-08-06 10:41:20.885000 | synced | |
| 105 | sys | schema_unused_indexes | create view | public | 102 | 104 | 0 | 2025-08-06 10:41:20.634000 | 2025-08-06 10:41:20.685000 | 2025-08-06 10:41:20.735000 | synced | |
| 103 | sys | | create schema | public | 102 | 0 | 0 | 2025-08-06 10:41:20.585000 | 2025-08-06 10:41:20.585000 | 2025-08-06 10:41:20.634000 | synced | |
| 101 | mysql | tidb_pitr_id_map | create table | public | 1 | 100 | 0 | 2025-08-06 10:41:20.485000 | 2025-08-06 10:41:20.485000 | 2025-08-06 10:41:20.534000 | synced | |
| 99 | mysql | request_unit_by_group | create table | public | 1 | 98 | 0 | 2025-08-06 10:41:20.385000 | 2025-08-06 10:41:20.434000 | 2025-08-06 10:41:20.485000 | synced | |
| 97 | mysql | dist_framework_meta | create table | public | 1 | 96 | 0 | 2025-08-06 10:41:20.284000 | 2025-08-06 10:41:20.335000 | 2025-08-06 10:41:20.385000 | synced | |
| 95 | mysql | tidb_runaway_watch_done | create table | public | 1 | 94 | 0 | 2025-08-06 10:41:20.185000 | 2025-08-06 10:41:20.234000 | 2025-08-06 10:41:20.284000 | synced | |
+--------+---------+-------------------------+---------------+--------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+---------------+-------------+
10 rows in set (0.01 sec)
```
but DXF goroutine does not exit
```
goroutine 89587 [semacquire, 360 minutes]:
sync.runtime_Semacquire(0xc01105ee40?)
/usr/local/go/src/runtime/sema.go:71 +0x25
sync.(*WaitGroup).Wait(0x640f480?)
/usr/local/go/src/sync/waitgroup.go:118 +0x48
golang.org/x/sync/errgroup.(*Group).Wait(0xc010fcb7c0)
/root/go/pkg/mod/golang.org/x/sync@v0.8.0/errgroup/errgroup.go:56 +0x25
github.com/pingcap/tidb/pkg/ddl.(*worker).executeDistTask(0xc010b87570, {0x706ba60, 0xc0110dc0a0}, {0x70aefd0, 0xc01089b200}, 0xc010fc8800)
/workspace/source/tidb/pkg/ddl/index.go:2619 +0xe05
github.com/pingcap/tidb/pkg/ddl.(*worker).addTableIndex(0xc010b87570, {0x706ba60, 0xc0110dc0a0}, {0x70aefd0, 0xc01089b200}, 0xc010fc8800)
/workspace/source/tidb/pkg/ddl/index.go:2407 +0x65
github.com/pingcap/tidb/pkg/ddl.runReorgJobAndHandleErr.func2()
/workspace/source/tidb/pkg/ddl/index.go:1526 +0xdc
github.com/pingcap/tidb/pkg/ddl.(*worker).runReorgJob.func1()
/workspace/source/tidb/pkg/ddl/reorg.go:379 +0x29
github.com/pingcap/tidb/pkg/util.(*WaitGroupWrapper).Run.func1()
/workspace/source/tidb/pkg/util/wait_group_wrapper.go:157 +0x4c
created by github.com/pingcap/tidb/pkg/util.(*WaitGroupWrapper).Run in goroutine 89577
/workspace/source/tidb/pkg/util/wait_group_wrapper.go:155 +0x73
```
### 4. What is your TiDB version? (Required)
at least
v8.5.2
[goroutine.txt](https://github.com/user-attachments/files/21614531/goroutine.txt)
[tidb.log](https://github.com/user-attachments/files/21614789/tidb.log)
Contributor guide
Assessment
This issue has not been assessed yet.