You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "EarlyBedEarlyUp (via GitHub)" <gi...@apache.org> on 2023/11/06 03:36:17 UTC
[I] 在 Triple 协议下,配置最大消息长度无效 (ServiceConfig 中的 GrpcMaxMessageSize 配置项) [dubbo-go]
EarlyBedEarlyUp opened a new issue, #2487:
URL: https://github.com/apache/dubbo-go/issues/2487
### Environment
- Server: Dubbo-go, v3.0.5
- Client: Dubbo-go, v3.0.5
- Protocol: Triple
- Registry: Nacos, v2.2.3
### Issue description
如题,通过下面的配置方式初始化dubbo-go,最大消息长度仍然是默认的4M
```go
func InitDubbo(moduleName, environmentName, groupName, nacosUrl, nameSpace string, nacosPort int) {
dataId := fmt.Sprintf("%s-%s", moduleName, environmentName)
nacosAddress := fmt.Sprintf("%s:%d", nacosUrl, nacosPort)
initProvider()
// 单独给这个服务设置grpc最大值
fileServiceConfig := config.NewServiceConfigBuilder().Build()
fileServiceConfig.GrpcMaxMessageSize = 100
rootConfig := config.NewRootConfigBuilder().
SetProvider(config.NewProviderConfigBuilder().
AddService("FileProvider", fileServiceConfig).Build()).
SetConfigCenter(config.NewConfigCenterConfigBuilder().
SetProtocol("nacos").SetAddress(nacosAddress).SetNamespace(nameSpace).
SetDataID(dataId).SetGroup(groupName).Build()).
Build()
if err := config.Load(config.WithRootConfig(rootConfig)); err != nil {
panic("Init Dubbo Error Please Check Config")
}
}
```
打断点调试后发现在 `/protocol/dubbo3/dubbo3_protocol.go` 的 `openServer` 方法中虽然有下列配置最大消息的代码,但是只有第一个 Provider 的配置才会走这段代码,而注册的第一个服务是 `ServerReflection` ,此服务是默认配置,而不是我上述代码的配置。
```go
// openServer open a dubbo3 server, if there is already a service using the same protocol, it returns directly.
func (dp *DubboProtocol) openServer(url *common.URL, tripleCodecType tripleConstant.CodecType) {
dp.serverLock.Lock()
defer dp.serverLock.Unlock()
_, ok := dp.serverMap[url.Location]
// 此处的判断导致带有 GrpcMaxMessageSize 配置内容的 Provider 被return,无法改变 Triple 的配置
if ok {
dp.serverMap[url.Location].RefreshService()
return
}
// ... 省略代码
if maxCall := url.GetParam(constant.MaxServerRecvMsgSize, ""); maxCall != "" {
if size, err := strconv.Atoi(maxCall); err == nil && size != 0 {
opts = append(opts, triConfig.WithGRPCMaxServerRecvMessageSize(size))
}
}
if maxCall := url.GetParam(constant.MaxServerSendMsgSize, ""); maxCall != "" {
if size, err := strconv.Atoi(maxCall); err == nil && size != 0 {
opts = append(opts, triConfig.WithGRPCMaxServerSendMessageSize(size))
}
}
// ... 省略代码
}
```
### Logs
断点调试信息

--
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.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: [I] 在 Triple 协议下,配置最大消息长度无效 (ServiceConfig 中的 GrpcMaxMessageSize 配置项) [dubbo-go]
Posted by "AlexStocks (via GitHub)" <gi...@apache.org>.
AlexStocks closed issue #2487: 在 Triple 协议下,配置最大消息长度无效 (ServiceConfig 中的 GrpcMaxMessageSize 配置项)
URL: https://github.com/apache/dubbo-go/issues/2487
--
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: [I] 在 Triple 协议下,配置最大消息长度无效 (ServiceConfig 中的 GrpcMaxMessageSize 配置项) [dubbo-go]
Posted by "1kasa (via GitHub)" <gi...@apache.org>.
1kasa commented on issue #2487:
URL: https://github.com/apache/dubbo-go/issues/2487#issuecomment-2671038249
问题已修复,详细请参考这个pr中https://github.com/apache/dubbo-go/pull/2246 这个pr中对triple协议下的最大消息配置进行了重构(具体原因是对于服务器端来说,provider提供商导出的顺序并不总是相同的,导致有时最大服务器发送max-msg-size不生效),这个pr已经把ServiceConfig 中的 GrpcMaxMessageSize 配置项删掉了,改为protocolConfig中的MaxServerSendMsgSize与MaxServerRecvMsgSize。
--
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