ddl/ddl.go: Recv from chan `task.err` may block forever when send is skipped
#26 763 ouverte le 31 juil. 2021
Métriques du dépôt
- Stars
- (40 090 stars)
- Métriques de merge PR
- (Merge moyen 14j 4h) (346 PRs mergées en 30 j)
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
We found this bug through a WIP Fuzzing project by system-pclub, PSU
2. What did you expect to see? (Required)
In ddl_worker.go, limitDDLJobs() calls addBatchDDLJobs() on L272 if selecting the first case, which in turn calls sending operation task.err <-err on L311.
https://github.com/pingcap/tidb/blob/fa71a0e46d427e8a7450a2dce27f8c0d4c02a45c/ddl/ddl_worker.go#L258-L275
https://github.com/pingcap/tidb/blob/fa71a0e46d427e8a7450a2dce27f8c0d4c02a45c/ddl/ddl_worker.go#L310-L311
Then in ddl.go, doDDLJob() calls receiving operation err := <-task.err on L540
https://github.com/pingcap/tidb/blob/fa71a0e46d427e8a7450a2dce27f8c0d4c02a45c/ddl/ddl.go#L534-L540
3. What did you see instead (Required)
If the select in limitDDLJobs() chooses the second case, the sending operation in function addBatchDDLJobs() will be skipped. Thus the receiving operation in doDDLJob() will block forever.
4. What is your TiDB version? (Required)
branch: master commit: 7e6690df8e8d5474b1872edbd279bb1b3c510ee5