Skip to content

Conversation

EvenLjj
Copy link
Collaborator

@EvenLjj EvenLjj commented Oct 13, 2025

fix sharedChannel concurrent destroy problem

Summary by CodeRabbit

  • Bug Fixes
    • Improved client disconnect handling to avoid premature cleanup and ensure channels are only removed after confirmed shutdown, resulting in more reliable connection lifecycle and smoother shutdown behavior.
  • Tests
    • Removed unnecessary delays in integration tests, significantly reducing test execution time and helping lower flakiness during setup.

@sofastack-cla sofastack-cla bot added bug Something isn't working cla:yes CLA is ok size/S labels Oct 13, 2025
Copy link
Contributor

coderabbitai bot commented Oct 13, 2025

Walkthrough

Updates TripleClientTransport.disconnect to conditionally clean up the channel map based on channel shutdown state. Removes Thread.sleep calls from two Triple stream integration tests to eliminate setup delays.

Changes

Cohort / File(s) Summary
Triple client transport disconnect logic
remoting/remoting-triple/.../TripleClientTransport.java
Disconnect now removes provider from channelMap and nulls channel only when channel.isShutdown() is true; if channel is null, still removes from channelMap; avoids unconditional removal when channel exists but isn’t fully shut down.
Integration tests: remove setup sleeps
test/test-integration/.../TripleGenericStreamTest.java, test/test-integration/.../TripleStubStreamTest.java
Eliminated 5s and 10s Thread.sleep calls from setup phases; no other logic changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Caller
  participant Transport as TripleClientTransport
  participant Channel
  participant Map as channelMap

  Caller->>Transport: disconnect(providerInfo)
  alt channel != null
    Transport->>Channel: shutdown()
    Transport->>Channel: isShutdown()
    alt isShutdown == true
      Transport->>Map: remove(providerInfo)
      note right of Transport: channel set to null
    else isShutdown == false
      note right of Transport: retain channel and map entry
    end
  else channel == null
    Transport->>Map: remove(providerInfo)
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I twitch my ears at cleaner flows,
Map stays neat as shutdown goes.
No more naps in tests, hooray—
Faster hops through setup’s day.
With careful checks and lighter leap,
This rabbit guards the channel’s sleep.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title accurately describes the primary change, which addresses a concurrency bug in the sharedChannel destruction logic by tightening map cleanup behavior, and it is concise and specific enough for a teammate scanning the history to understand the fix.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cf3a261 and 58d3dbc.

📒 Files selected for processing (3)
  • remoting/remoting-triple/src/main/java/com/alipay/sofa/rpc/transport/triple/TripleClientTransport.java (1 hunks)
  • test/test-integration/src/test/java/com/alipay/sofa/rpc/test/triple/stream/TripleGenericStreamTest.java (0 hunks)
  • test/test-integration/src/test/java/com/alipay/sofa/rpc/test/triple/stream/TripleStubStreamTest.java (0 hunks)
💤 Files with no reviewable changes (2)
  • test/test-integration/src/test/java/com/alipay/sofa/rpc/test/triple/stream/TripleGenericStreamTest.java
  • test/test-integration/src/test/java/com/alipay/sofa/rpc/test/triple/stream/TripleStubStreamTest.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: sca

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@EvenLjj EvenLjj merged commit f468373 into sofastack:master Oct 14, 2025
5 checks passed
@EvenLjj EvenLjj added this to the 5.14.0 milestone Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cla:yes CLA is ok size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants