What was reported:
GitHub issue pingcap/tidb#58600 (closed, 25 comments): ## Bug Report Please answer these questions before submitting your issue. Thanks! ### 1. Minimal reproduce step (Required) I'm sorry, but I'm not sure how to reproduce the issue. It occurs sporadically on multiple running TiDB processes. ### 2. What did you expect to see? (Required) ### 3. What did you see instead (Required) fatal error on https://github.com/pingcap/tidb/blob/d13e52ed6e22cc5789bed7c64c861578cd2ed55b/pkg/sessionctx/stmtctx/stmtctx.go#L800-L804 . These errors always occur on the same line. ``` fatal error: sync: unlock of unlocked mutex goroutine 322590843 [running]: sync.fatal(

What works:
[chibiegg (reporter)]: Based on what I’ve seen, in my environment, every occurrence of the panic happened during calls originating from setDataForProcessList (infoschema_reader.go:1843). I’ll try running the patch you provided on my local environment. If it works, should we skip the previously committed workaround and only introduce the handling of RefCountOfStmtCtx? Or is it better to keep both changes?