AlexStocks commented on code in PR #3231:
URL: https://github.com/apache/dubbo-go/pull/3231#discussion_r2899091507
##########
protocol/dubbo3/dubbo3_protocol.go:
##########
@@ -80,17 +77,16 @@ func NewDubboProtocol() *DubboProtocol {
func (dp *DubboProtocol) Export(invoker base.Invoker) base.Exporter {
url := invoker.GetURL()
serviceKey := url.ServiceKey()
- exporter := NewDubboExporter(serviceKey, invoker, dp.ExporterMap(),
dp.serviceMap)
- dp.SetExporterMap(serviceKey, exporter)
- logger.Infof("[Triple Protocol] Export service: %s", url.String())
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` 提前 `return nil` 导致 exporter 没有写入 map,`grpc/server.go` 的
`waitGrpcExporter` 会等待 exporter 数量与 providerServices 数量一致,因超时最终触发 `panic("wait
grpc exporter timeout")`,真正原因(缺少 `RpcServiceKey`)被完全隐藏,排查极难。
调用方(`server/action.go`、`config/service_config.go`)会把 nil 当错误向上传递,但中间层 filter
chain 不一定做了 nil 检查,存在隐患。
--
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]