Copilot commented on code in PR #3231:
URL: https://github.com/apache/dubbo-go/pull/3231#discussion_r2893919865
##########
protocol/dubbo3/dubbo3_protocol.go:
##########
@@ -86,11 +83,13 @@ func (dp *DubboProtocol) Export(invoker base.Invoker)
base.Exporter {
key := url.GetParam(constant.BeanNameKey, "")
var service any
- //TODO: Temporary compatibility with old APIs, can be removed later
- service = config.GetProviderService(key)
if rpcService, ok := url.GetAttribute(constant.RpcServiceKey); ok {
service = rpcService
}
+ if service == nil {
+ logger.Errorf("no rpc service found in url attribute %s for
service key: %s", constant.RpcServiceKey, key)
+ return nil
+ }
Review Comment:
Export() stores the exporter into dp.ExporterMap() before verifying that the
service instance exists (RpcServiceKey). If the attribute is missing, the
function returns nil but leaves a stale exporter entry in the map, which can
cause inconsistent state and later panics/timeouts. Consider validating the
service first (before SetExporterMap), or removing the exporter from the map on
this failure path, and ensure Export() never returns nil after partially
mutating protocol state.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]