eye-gu opened a new issue, #3310: URL: https://github.com/apache/dubbo-go/issues/3310
### ✅ 验证清单 - [x] 🔍 我已经搜索过 [现有 Issues](https://github.com/apache/dubbo-go/issues),确信这不是重复问题 ### 🚀 Go 版本 1.25 ### 📦 Dubbo-go 版本 develop ### 🖥️ 服务端配置 _No response_ ### 💻 客户端配置 _No response_ ### 🌐 协议配置 _No response_ ### 📋 注册中心配置 _No response_ ### 💾 操作系统 🍎 macOS ### 📝 Bug 描述 当向一个尚未注册的服务路径发送JSON-RPC请求时(即,在`ExporterMap`中不存在),服务器会因为指针为空而崩溃 https://github.com/apache/dubbo-go/blob/ea93b8a9e1c0a9b8b05e786d955ab4f8aeaa221d/protocol/jsonrpc/server.go#L353 ### 🔄 重现步骤 正确path:/GreetProvider, 但是curl请求/GreetProvider1 ```shell curl --location --request POST '127.0.0.1:20002/GreetProvider1' \ --header 'Content-Type: application/json' \ --data-raw '{ "jsonrpc": "2.0", "method": "SayHello", "params": [ "hello", "new", "jsonrpc" ], "id": 1650901121 }' ``` ### ✅ 预期行为 服务器应返回一条错误消息,指明服务未被发现,而非崩溃。 ### ❌ 实际行为 nil pointer dereference panic ### 💡 可能的解决方案 检查 `ExporterMap().Load(path)` 的返回值 `ok`,当服务未找到时直接返回明确的错误: ```go exporter, ok := jsonrpcProtocol.ExporterMap().Load(path) if !ok { return perrors.Errorf("service not found: %s", path) } ``` -- 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]
