pingcap/tidb

ddl/ddl.go: Recv from chan `task.err` may block forever when send is skipped

Open

#26.763 aperta il 31 lug 2021

Vedi su GitHub
 (4 commenti) (0 reazioni) (1 assegnatario)Go (6186 fork)batch import
help wantedsig/sql-infratype/enhancement

Metriche repository

Star
 (40.090 star)
Metriche merge PR
 (Merge medio 14g 4h) (346 PR mergiate in 30 g)

Descrizione

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

Guida contributor