Skip to content

fix: unregister resource when closing DataSourceProxy#7981

Open
Sumit6307 wants to merge 3 commits intoapache:2.xfrom
Sumit6307:fix-datasource-resource-leak
Open

fix: unregister resource when closing DataSourceProxy#7981
Sumit6307 wants to merge 3 commits intoapache:2.xfrom
Sumit6307:fix-datasource-resource-leak

Conversation

@Sumit6307
Copy link
Contributor

Implemented the TODO item in DataSourceProxy.close() to ensure that resources are properly unregistered from the
DefaultResourceManager
when the proxy is closed. This prevents potential resource leaks by ensuring DefaultResourceManager.get().unregisterResource(this) is called.

Ⅱ. Does this pull request fix one issue?
Fixes missing resource cleanup in
DataSourceProxy
.

Ⅲ. Why don't you add test cases (unit test/integration test)?
I have updated the existing unit test
DataSourceProxyTest
. Specifically, I modified
testCloseRemovesResource
to verify that
unregisterResource
is called when the proxy is closed.

Ⅳ. Describe how to verify it
Run the unit tests for the datasource module: mvn -pl rm-datasource -Dtest=DataSourceProxyTest test

Ⅴ. Special notes for reviews
This change simply addresses an existing TODO comment to ensure cleaner resource lifecycle management.

@codecov
Copy link

codecov bot commented Jan 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.28%. Comparing base (e006d10) to head (ecf73b0).

Additional details and impacted files
@@            Coverage Diff            @@
##                2.x    #7981   +/-   ##
=========================================
  Coverage     72.28%   72.28%           
  Complexity      876      876           
=========================================
  Files          1310     1310           
  Lines         49977    49978    +1     
  Branches       5945     5945           
=========================================
+ Hits          36127    36129    +2     
  Misses        10903    10903           
+ Partials       2947     2946    -1     
Files with missing lines Coverage Δ
...rg/apache/seata/rm/datasource/DataSourceProxy.java 64.76% <100.00%> (+0.33%) ⬆️

... and 6 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.

@Sumit6307
Copy link
Contributor Author

@funky-eyes Sir Please Check and merge this PR #7981

@Sumit6307
Copy link
Contributor Author

Implemented the TODO item in DataSourceProxy.close() to ensure that resources are properly unregistered from the DefaultResourceManager when the proxy is closed. This prevents potential resource leaks by ensuring DefaultResourceManager.get().unregisterResource(this) is called.

Ⅱ. Does this pull request fix one issue? Fixes missing resource cleanup in DataSourceProxy .

Ⅲ. Why don't you add test cases (unit test/integration test)? I have updated the existing unit test DataSourceProxyTest . Specifically, I modified testCloseRemovesResource to verify that unregisterResource is called when the proxy is closed.

Ⅳ. Describe how to verify it Run the unit tests for the datasource module: mvn -pl rm-datasource -Dtest=DataSourceProxyTest test

Ⅴ. Special notes for reviews This change simply addresses an existing TODO comment to ensure cleaner resource lifecycle management.

Sir @funky-eyes Please Review this PR

@Sumit6307
Copy link
Contributor Author

@funky-eyes Review this

@Sumit6307 Sumit6307 force-pushed the fix-datasource-resource-leak branch from ecf73b0 to 06895fc Compare March 7, 2026 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants