CAICAIIs opened a new issue, #1078:
URL: https://github.com/apache/incubator-seata-go/issues/1078

   ### ✅ 验证清单
   
   - [x] 🔍 我已经搜索过 [现有 
Issues](https://github.com/apache/incubator-seata-go/issues),确信这不是重复问题
   - [x] 🛠️ 我愿意自己处理这个议题
   
   ### 🚀 Go 版本
   
   1.26.1
   
   ### 📦 Seata-go 版本
   
   v2.1.0-7-gfb6f02b
   
   ### 💾 操作系统
   
   🍎 macOS
   
   ### 📝 Bug 描述
   
   In TCC fence log cleanup, `initLogCleanTask` pushes `&identity` into 
`logQueue`:
   
   ```go
   for _, identity := range identityList {
        handler.logQueue <- &identity
   }
   ```
   This repository still uses go 1.20. Under Go 1.20 range semantics, identity 
is a reused loop variable, so &identity points to the same address across 
iterations.
   
   As a result, multiple queued items may all reference the last element in 
identityList, causing duplicated batch delete inputs and missed cleanup of 
other expired fence logs.
   
   ### 🔄 重现步骤
   
   1. Keep module language version as go 1.20.
   2. Run a minimal example:
   ```go
   items := []Item{{Name: "A"}, {Name: "B"}, {Name: "C"}}
   for _, item := range items {
        ptrs = append(ptrs, &item)
   }
   ```
   3. Observe that all pointers finally point to the last item under Go 1.20 
semantics.
   4. The same pattern exists in TCC fence cleanup.
   
   ### ✅ 预期行为
   
   Each queued cleanup item should reference a distinct fence log identity, and 
batch deletion should use the original (xid, branch_id) pairs.
   
   ### ❌ 实际行为
   
   Queued pointers may all reference the last identity, which can lead to 
duplicated delete parameters and missed cleanup of other expired fence logs.
   
   ### 💡 可能的解决方案
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to