You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by "Vanillaxi (via GitHub)" <gi...@apache.org> on 2026/09/18 15:11:56 UTC

[PR] fix:preserve undo errors and release resources [incubator-seata-go]

Vanillaxi opened a new pull request, #1184:
URL: https://github.com/apache/incubator-seata-go/pull/1184

   <!--  Thanks for sending a pull request!
   -->
   <!-- Please make sure you have read and understood the contributing guidelines -->
   
   - [ ] I have registered the PR [changes](https://github.com/apache/incubator-seata-go/tree/master/changes).
   
   **What this PR does**:
   改动限制在 `undo.go` 和 `undo_test.go` 中
   
   `BaseUndoLogManager.Undo` :
   
   1. `rows.Close()`、`stmt.Close()`、`tx.Rollback()` 不再赋值给命名返回值 err。保留原始执行错误,清理失败单独记录日志。
   2. 注册 `defer func` 后,直接执行事务回滚,不再通过 `err != nil` 来决定事务回滚
   3. `db.Conn(ctx)` 取得连接后,通过注册 `defer conn.Close()` 安排归还
   4. 对于 `GlobalFinished `日志或空 SQL Undo 日志列表,把 `return nil` 改成 `return tx.Commit()`
   
   **Which issue(s) this PR fixes**:
   
   <!--
   *Automatically closes linked issue when PR is merged.
   Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
   _If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
   -->
   
   Fixes #1183 
   
   **Special notes for your reviewer**:
   
   **Does this PR introduce a user-facing change?**:
   
   <!--
   If no, just write "NONE" in the release-note block below.
   If yes, a release note is required:
   Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
   -->
   
   ```release-note
   
   ```
   


-- 
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: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] fix:preserve undo errors and release resources [incubator-seata-go]

Posted by "ssshr-66 (via GitHub)" <gi...@apache.org>.
ssshr-66 commented on PR #1184:
URL: https://github.com/apache/incubator-seata-go/pull/1184#issuecomment-5733196479

   Thanks for the clarification. I’ll follow up on the CI issue and your PR.


-- 
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: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] fix:preserve undo errors and release resources [incubator-seata-go]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #1184:
URL: https://github.com/apache/incubator-seata-go/pull/1184#issuecomment-5732902026

   > Bot detected the issue body's language is not English, translate it automatically.
   
   The CI failed because an existing gRPC test triggered a data race, unrelated to this fix.
   
   Failed Use Case: `TestE2E_SyncRequestResponseFuture', Error: `warning: data race`
   
   Test A: [`TestE2E_HeartbeatSentToServer` (e2e_test.go: 125)] (https://github.com/apache/incubator-seata-go/blob/598074146bc4142dd33f29d5d2a2049c90ba0f6f/pkg/remoting/grpc/e2e_test.go # L125) 
   Test B: [`TestE2E_SyncRequestResponseFuture` (e2e_test.go: 153)] (https://github.com/apache/incubator-seata-go/blob/598074146bc4142dd33f29d5d2a2049c90ba0f6f/pkg/remoting/grpc/e2e_test.go # L153)The previous heartbeat test A started the background message processing goroutine, while the WaitGroup during cleanup only waited for the transceiver cycle, and did not wait for the message processing goroutine to start internally.The latter test B then writes a shared `typeMap' at [`pkg/remoting/grpc/e2e_test.go: 159`] (https://github.com/apache/incubator-seata-go/blob/598074146bc4142dd33f29d5d2a2049c90ba0f6f/pkg/remoting/grpc/e2e_test.go # L159) and forms a data race with background message processing goroutine at [`pkg/remoting/grpc/listener.go: 147`] (https://github.com/apache/incubator-seata-go/blob/598074146bc4142dd33f29d5d2a2049c90ba0f6f/pkg/remoting/grpc/listener.go # L147) for unsynchronized reads of the same map.
   
   Local Recreation Orders:
   
   ```go test-race-count = 10-timeout 60s\
     -run '^ TestE2E_(HeartbeatSentToServer | SyncRequestResponseFuture) $'\
     ./pkg/remoting/grpc
   ```
   
   At the same time, it was detected that `processorMap` also has the same type of competition


-- 
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: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] fix:preserve undo errors and release resources [incubator-seata-go]

Posted by "ssshr-66 (via GitHub)" <gi...@apache.org>.
ssshr-66 merged PR #1184:
URL: https://github.com/apache/incubator-seata-go/pull/1184


-- 
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: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] fix:preserve undo errors and release resources [incubator-seata-go]

Posted by "Vanillaxi (via GitHub)" <gi...@apache.org>.
Vanillaxi commented on PR #1184:
URL: https://github.com/apache/incubator-seata-go/pull/1184#issuecomment-5732900123

   CI 失败是因为已有的 gRPC 测试触发了 data race ,与本次修复无关。
   
   失败用例: `TestE2E_SyncRequestResponseFuture`,错误: `WARNING: DATA RACE`
   
   测试 A:[`TestE2E_HeartbeatSentToServer`(e2e_test.go:125)](https://github.com/apache/incubator-seata-go/blob/598074146bc4142dd33f29d5d2a2049c90ba0f6f/pkg/remoting/grpc/e2e_test.go#L125) 
   测试 B:[`TestE2E_SyncRequestResponseFuture`(e2e_test.go:153)](https://github.com/apache/incubator-seata-go/blob/598074146bc4142dd33f29d5d2a2049c90ba0f6f/pkg/remoting/grpc/e2e_test.go#L153)
   
   前一个心跳测试A启动了后台消息处理 goroutine,而清理时的 WaitGroup 只等待收发循环,没有等待内部启动的消息处理 goroutine。于是后一个测试B在 [`pkg/remoting/grpc/e2e_test.go:159`](https://github.com/apache/incubator-seata-go/blob/598074146bc4142dd33f29d5d2a2049c90ba0f6f/pkg/remoting/grpc/e2e_test.go#L159) 写入共享 `typeMap`,与后台消息处理 goroutine 在 [`pkg/remoting/grpc/listener.go:147`](https://github.com/apache/incubator-seata-go/blob/598074146bc4142dd33f29d5d2a2049c90ba0f6f/pkg/remoting/grpc/listener.go#L147) 对同一 map 的未同步读取形成 data race 。
   
   本地复现命令:
   
   ```
   go test -race -count=10 -timeout 60s \
     -run '^TestE2E_(HeartbeatSentToServer|SyncRequestResponseFuture)$' \
     ./pkg/remoting/grpc
   ```
   
   同时检测到了 `processorMap` 也存在同类型竞争


-- 
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: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] fix:preserve undo errors and release resources [incubator-seata-go]

Posted by "ssshr-66 (via GitHub)" <gi...@apache.org>.
ssshr-66 commented on PR #1184:
URL: https://github.com/apache/incubator-seata-go/pull/1184#issuecomment-5732766242

   plz fix ci


-- 
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: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] fix:preserve undo errors and release resources [incubator-seata-go]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #1184:
URL: https://github.com/apache/incubator-seata-go/pull/1184#issuecomment-5732094697

   ## [Codecov](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1184?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 61.18%. Comparing base ([`5980741`](https://app.codecov.io/gh/apache/incubator-seata-go/commit/598074146bc4142dd33f29d5d2a2049c90ba0f6f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`e2f17d1`](https://app.codecov.io/gh/apache/incubator-seata-go/commit/e2f17d1e1bc7fa676dfde22c9ac885514a0c267d?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1184      +/-   ##
   ==========================================
   + Coverage   61.11%   61.18%   +0.07%     
   ==========================================
     Files         309      309              
     Lines       22626    22625       -1     
   ==========================================
   + Hits        13827    13843      +16     
   + Misses       7518     7502      -16     
   + Partials     1281     1280       -1     
   ```
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1184?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   </details>


-- 
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: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org


Re: [PR] fix:preserve undo errors and release resources [incubator-seata-go]

Posted by "ssshr-66 (via GitHub)" <gi...@apache.org>.
ssshr-66 commented on PR #1184:
URL: https://github.com/apache/incubator-seata-go/pull/1184#issuecomment-5733190248

   > #1183
   
   Thanks for the clarification. I’ll follow up on the CI issue and your PR.


-- 
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: notifications-unsubscribe@seata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org