Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@YongGoose
Copy link
Member

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

fixes #5283

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@YongGoose YongGoose requested a review from Copilot May 23, 2025 06:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request updates the resource cleanup logic for channel disconnection to ensure that both the pending message futures and the child–parent mapping are cleaned up properly when a channel disconnects. Key changes include:

  • Introduction of a new childToParentMap field in tests and corresponding assertions to validate its cleanup.
  • Modifications in AbstractNettyRemotingClient to remove parent mapping from mergeMsgMap when cleaning up message futures.
  • Updates to logging and code formatting for improved readability.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
core/src/test/java/org/apache/seata/core/rpc/netty/ResourceCleanupTest.java Adds childToParentMap initialization and assertions to verify cleanup on channel disconnection.
core/src/main/java/org/apache/seata/core/rpc/netty/AbstractNettyRemotingClient.java Refactors resource cleanup logic, updates scheduling lambda formatting, and adjusts exception logging in sendAsyncRequest.
changes/zh-cn/2.x.md Updates changelog to include the new resource cleanup behavior.
changes/en-us/2.x.md Updates changelog to include the new resource cleanup behavior.
Comments suppressed due to low confidence (2)

core/src/main/java/org/apache/seata/core/rpc/netty/AbstractNettyRemotingClient.java:227

  • Consider providing a more descriptive Throwable message instead of using a hardcoded "throw" to give clearer context for the exception.
throw new FrameworkException(new Throwable("throw"), "frameworkException", FrameworkErrorCode.ChannelIsNotWritable);

core/src/main/java/org/apache/seata/core/rpc/netty/AbstractNettyRemotingClient.java:517

  • [nitpick] If multiple child messages share the same parent ID, removing the parent's mapping for each child could potentially lead to premature cleanup of mergeMsgMap; ensure that this behavior is as intended or consider grouping removals by parent ID.
Integer parentId = childToParentMap.remove(messageId);

@YongGoose
Copy link
Member Author

After applying Spotless and creating a PR, it seems that a lot more code gets modified than what I actually changed, which makes the review process more difficult.

@codecov
Copy link

codecov bot commented May 23, 2025

Codecov Report

Attention: Patch coverage is 38.09524% with 26 lines in your changes missing coverage. Please review.

Project coverage is 58.42%. Comparing base (152a7f9) to head (1a93d9b).
Report is 1 commits behind head on 2.x.

Files with missing lines Patch % Lines
...ta/core/rpc/netty/AbstractNettyRemotingClient.java 38.09% 25 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##                2.x    #7360   +/-   ##
=========================================
  Coverage     58.41%   58.42%           
  Complexity      535      535           
=========================================
  Files          1272     1272           
  Lines         45853    45865   +12     
  Branches       5520     5521    +1     
=========================================
+ Hits          26785    26795   +10     
- Misses        16546    16548    +2     
  Partials       2522     2522           
Files with missing lines Coverage Δ
...ta/core/rpc/netty/AbstractNettyRemotingClient.java 37.62% <38.09%> (+0.16%) ⬆️

... and 5 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@funky-eyes funky-eyes changed the title Update resource cleanup logic for channel disconnection optimize: update resource cleanup logic for channel disconnection May 23, 2025
@funky-eyes
Copy link
Contributor

After applying Spotless and creating a PR, it seems that a lot more code gets modified than what I actually changed, which makes the review process more difficult.

I agree, so we should submit a PR to format all the code with Spotless at once, otherwise it will seriously affect the efficiency of code review. @slievrly

@funky-eyes funky-eyes added this to the 2.5.0 milestone May 23, 2025
Copy link
Contributor

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@funky-eyes funky-eyes merged commit 5cbc488 into apache:2.x May 24, 2025
8 of 9 checks passed
YoWuwuuuw pushed a commit to YoWuwuuuw/incubator-seata that referenced this pull request Jun 10, 2025
slievrly pushed a commit to slievrly/fescar that referenced this pull request Oct 21, 2025
YvCeung pushed a commit to YvCeung/incubator-seata that referenced this pull request Dec 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ClientOnResponseProcessor#mergeMsgMap&futures is a risk of memory leaks

2 participants