You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "No-SilverBullet (via GitHub)" <gi...@apache.org> on 2024/08/09 02:40:43 UTC

[PR] fix: set baseinvoker's url to nil to address memory leak issues [dubbo-go]

No-SilverBullet opened a new pull request, #2726:
URL: https://github.com/apache/dubbo-go/pull/2726

   Bssed on PR #2223 ,the main purpose of this PR is to fix the memory leak problem caused by the url pointer in baseinvoker not being released correctly. You can refer to the following issue:


-- 
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@dubbo.apache.org

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


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


Re: [PR] fix: set baseinvoker's url to nil to address memory leak issues [dubbo-go]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #2726:
URL: https://github.com/apache/dubbo-go/pull/2726#issuecomment-2277039549

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2726) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2726&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=2726&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=2726&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2726&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=2726&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=2726)
   
   


-- 
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@dubbo.apache.org

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


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


Re: [PR] fix: set baseinvoker's url to nil to address memory leak issues [dubbo-go]

Posted by "No-SilverBullet (via GitHub)" <gi...@apache.org>.
No-SilverBullet commented on code in PR #2726:
URL: https://github.com/apache/dubbo-go/pull/2726#discussion_r1710809040


##########
protocol/invoker.go:
##########
@@ -88,11 +88,12 @@ func (bi *BaseInvoker) Invoke(context context.Context, invocation Invocation) Re
 	return &RPCResult{}
 }
 
-// Destroy changes available and destroyed flag
+// Destroy changes available and destroyed flag and release the url's allocated memory
 func (bi *BaseInvoker) Destroy() {
 	logger.Infof("Destroy invoker: %s", bi.GetURL())
 	bi.destroyed.Store(true)
 	bi.available.Store(false)
+	bi.url = nil

Review Comment:
   As u can see in other changed files, in other places where`url` are used, I changed the order, that is, destroyed them in the end to avoid null pointer issues; But still requires careful review;



-- 
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@dubbo.apache.org

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


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


Re: [PR] fix: set baseinvoker's url to nil to address memory leak issues [dubbo-go]

Posted by "chickenlj (via GitHub)" <gi...@apache.org>.
chickenlj merged PR #2726:
URL: https://github.com/apache/dubbo-go/pull/2726


-- 
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@dubbo.apache.org

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


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


Re: [PR] fix: set baseinvoker's url to nil to address memory leak issues [dubbo-go]

Posted by "AlexStocks (via GitHub)" <gi...@apache.org>.
AlexStocks commented on code in PR #2726:
URL: https://github.com/apache/dubbo-go/pull/2726#discussion_r1710802802


##########
protocol/invoker.go:
##########
@@ -88,11 +88,12 @@ func (bi *BaseInvoker) Invoke(context context.Context, invocation Invocation) Re
 	return &RPCResult{}
 }
 
-// Destroy changes available and destroyed flag
+// Destroy changes available and destroyed flag and release the url's allocated memory
 func (bi *BaseInvoker) Destroy() {
 	logger.Infof("Destroy invoker: %s", bi.GetURL())
 	bi.destroyed.Store(true)
 	bi.available.Store(false)
+	bi.url = nil

Review Comment:
   set it nil to let the gc collect resource



-- 
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@dubbo.apache.org

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


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


Re: [PR] fix: set baseinvoker's url to nil to address memory leak issues [dubbo-go]

Posted by "binbin0325 (via GitHub)" <gi...@apache.org>.
binbin0325 commented on code in PR #2726:
URL: https://github.com/apache/dubbo-go/pull/2726#discussion_r1710800869


##########
protocol/invoker.go:
##########
@@ -88,11 +88,12 @@ func (bi *BaseInvoker) Invoke(context context.Context, invocation Invocation) Re
 	return &RPCResult{}
 }
 
-// Destroy changes available and destroyed flag
+// Destroy changes available and destroyed flag and release the url's allocated memory
 func (bi *BaseInvoker) Destroy() {
 	logger.Infof("Destroy invoker: %s", bi.GetURL())
 	bi.destroyed.Store(true)
 	bi.available.Store(false)
+	bi.url = nil

Review Comment:
   If set nil, is there any risk of a null pointer elsewhere



-- 
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@dubbo.apache.org

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


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


Re: [PR] fix: set baseinvoker's url to nil to address memory leak issues [dubbo-go]

Posted by "No-SilverBullet (via GitHub)" <gi...@apache.org>.
No-SilverBullet commented on PR #2726:
URL: https://github.com/apache/dubbo-go/pull/2726#issuecomment-2292618740

   @chickenlj plz take the time to review this PR, thanks


-- 
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@dubbo.apache.org

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


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