Skip to content

fix(core): resolve #3247 lock misuse and map exposure races#3265

Open
xxs588 wants to merge 5 commits intoapache:developfrom
xxs588:fix/data-races-core-3247
Open

fix(core): resolve #3247 lock misuse and map exposure races#3265
xxs588 wants to merge 5 commits intoapache:developfrom
xxs588:fix/data-races-core-3247

Conversation

@xxs588
Copy link

@xxs588 xxs588 commented Mar 17, 2026

Description

Fixes #3247

This PR addresses core race points outside common/extension with minimal scoped changes:

  • dubbo.go
    • SetProviderService now uses proLock (instead of conLock)
    • GetConsumerConnection now uses conLock.RLock/RUnlock
  • cluster/router/chain/chain.go
    • RouterChain.Route now snapshots invokers under RLock before iteration
  • config/service.go
    • GetProviderServiceMap and GetConsumerServiceMap now return copied maps instead of internal references

Local verification:

  • go test -race ./cluster/router/chain/... ./config/...
  • go test -race ./... (shows pre-existing race failures in unrelated existing packages such as cluster/cluster/failback, config_center/apollo, config_center/file)

Checklist

  • I confirm the target branch is develop
  • Code has passed local testing
  • I have added tests that prove my fix is effective or that my feature works

@xxs588 xxs588 changed the base branch from main to develop March 17, 2026 15:09
@xxs588 xxs588 marked this pull request as draft March 17, 2026 15:21
@codecov-commenter
Copy link

codecov-commenter commented Mar 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.25%. Comparing base (60d1c2a) to head (1c6a61d).
⚠️ Report is 757 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3265      +/-   ##
===========================================
+ Coverage    46.76%   48.25%   +1.48%     
===========================================
  Files          295      466     +171     
  Lines        17172    34058   +16886     
===========================================
+ Hits          8031    16433    +8402     
- Misses        8287    16294    +8007     
- Partials       854     1331     +477     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xxs588 xxs588 force-pushed the fix/data-races-core-3247 branch from ba27fae to d8c2b5d Compare March 17, 2026 15:33
@xxs588 xxs588 marked this pull request as ready for review March 17, 2026 16:03
@xxs588 xxs588 marked this pull request as draft March 17, 2026 16:34
@xxs588 xxs588 force-pushed the fix/data-races-core-3247 branch from 6eeb263 to d8c2b5d Compare March 18, 2026 02:07
@sonarqubecloud
Copy link

@xxs588 xxs588 marked this pull request as ready for review March 18, 2026 02:52
@Alanxtl Alanxtl added ☢️ Bug 3.3.2 version 3.3.2 labels Mar 18, 2026
Copy link
Contributor

@Alanxtl Alanxtl left a comment

Choose a reason for hiding this comment

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

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.3.2 version 3.3.2 ☢️ Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Systematic data races: 20+ extension global maps unprotected, wrong lock in SetProviderService, RouterChain.Route lockless

3 participants