1kasa opened a new issue, #2808:
URL: https://github.com/apache/dubbo-go/issues/2808
### Environment
<!--
- Server: Dubbo-go, v3.3.0
- Client: Dubbo-go, v3.3.0
- Protocol: Triple
- Registry: zookeeper
-->
- Server: Dubbo-go, v3.3.0
- Client: Dubbo-go, v3.3.0
- Protocol: Triple
- Registry: zookeeper
### Issue description
Stream terminated by RST_STREAM with error code: INTERNAL_ERROR appears when
making unidirectional and bidirectional streaming RPC calls under Triple
protocol
client code:
```
// export DUBBO_GO_CONFIG_PATH=
PATH_TO_SAMPLES/helloworld/go-client/conf/dubbogo.yml
func main() {
err := config.Load()
if err != nil {
panic(err)
}
logger.Info("start to test triple unary context attachment transport")
req := &api.HelloRequest{
Name: "laurence",
}
ctx := context.Background()
// set user defined context attachment, map value can be string or
[]string, otherwise it is not to be transferred
userDefinedValueMap := make(map[string]interface{})
userDefinedValueMap["key1"] = "user defined value 1"
userDefinedValueMap["key2"] = "user defined value 2"
userDefinedValueMap["key3"] = []string{"user defined value 3.1", "user
defined value 3.2"}
userDefinedValueMap["key4"] = []string{"user defined value 4.1", "user
defined value 4.2"}
ctx = context.WithValue(ctx, constant.AttachmentKey,
userDefinedValueMap)
reply, err := grpcGreeterImpl.SayHello(ctx, req)
if err != nil {
logger.Error(err)
}
logger.Infof("client response result: %v\n", reply)
//stream rpc
logger.Info("start to test triple streaming rpc context attachment
transport")
request := &api.HelloRequest{
Name: "laurence",
}
stream, err := grpcGreeterImpl.SayHelloStream(ctx)
if err != nil {
logger.Error(err)
}
// stream grpc双向流式发送
err = stream.Send(request)
if err != nil {
logger.Error(err)
}
logger.Infof("client stream send request: %v\n", request)
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
reply, err := stream.Recv()
if err != nil {
logger.Error(err)
}
logger.Infof("client stream received result: %v\n", reply)
}()
wg.Wait()
}
```
server code:
```
func (s *GreeterProvider) SayHelloStream(svr
api.Greeter_SayHelloStreamServer) error {
// map must be assert to map[string]interface, because of dubbo
limitation
attachments :=
svr.Context().Value(constant.AttachmentKey).(map[string]interface{})
// value must be assert to []string[0], because of http2 header
limitation
logger.Infof("get triple attachment key1 = %s",
attachments["key1"].([]string)[0])
logger.Infof("get triple attachment key2 = %s",
attachments["key2"].([]string)[0])
logger.Infof("get triple attachment key3 = %s and %s",
attachments["key3"].([]string)[0],
attachments["key3"].([]string)[1])
logger.Infof("get triple attachment key4 = %s and %s",
attachments["key4"].([]string)[0],
attachments["key4"].([]string)[1])
c, err := svr.Recv()
if err != nil {
return err
}
logger.Infof("Dubbo-go3 GreeterProvider recv 1 user, name = %s\n",
c.Name)
err = svr.Send(&api.User{
Name: "hello " + c.Name,
Age: 18,
Id: "123456789",
})
if err != nil {
return err
}
return nil
}
func main() {
config.SetProviderService(&GreeterProvider{})
if err := config.Load(); err != nil {
panic(err)
}
select {}
}
```
### Logs
<details><summary>Click me to check logs</summary>
```
client:
2025-03-22 21:53:41 INFO cmd/client.go:69 start to test triple
streaming rpc context attachment transport
2025-03-22 21:53:41 INFO cmd/client.go:82 client stream send
request: name:"laurence"
2025-03-22 21:53:41 INFO
servicediscovery/service_instances_changed_listener_impl.go:100 Received
instance notification event of service dubbo.io, instance list size 1
2025-03-22 21:53:41 INFO tag/router.go:87 Config center does
not start, Tag router will not be enabled
2025-03-22 21:53:41 INFO condition/dynamic_router.go:301 Config
center does not start, Condition router will not be enabled
2025-03-22 21:53:41 INFO condition/dynamic_router.go:354 Config
center does not start, Condition router will not be enabled
2025-03-22 21:53:41 ERROR cmd/client.go:90 stream terminated by
RST_STREAM with error code: INTERNAL_ERROR
2025-03-22 21:53:41 INFO cmd/client.go:92 client stream
received result: <nil>
server:
2025/03/22 21:53:41 http2: panic serving 192.168.81.192:56592: interface
conversion: interface {} is nil, not []string
goroutine 90 [running]:
golang.org/x/net/http2.(*serverConn).runHandler.func1()
/Users/nyar/go/pkg/mod/golang.org/x/[email protected]/http2/server.go:2468
+0x13c
panic({0x10237bf80?, 0x1400087ed80?})
/opt/homebrew/opt/go/libexec/src/runtime/panic.go:785 +0x124
main.(*GreeterProvider).SayHelloStream(0x10398e630?, {0x1027636f8,
0x1400087c370})
/Users/nyar/go/dubbo-go-samples/compatibility/context/triple/go-server/cmd/server.go:70
+0x728
github.com/apache/dubbo-go-samples/compatibility/api._Greeter_SayHelloStream_Handler({0x102515ee0,
0x1400049b3f0}, {0x10275de68, 0x140004ba1e0})
/Users/nyar/go/dubbo-go-samples/compatibility/api/samples_api_triple.pb.go:213
+0x350
dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol.generateCompatStreamHandlerFunc.func1({0x1027572d8,
0x14000342910}, {0x103f88138, 0x140004ba1a0})
/Users/nyar/go/dubbo-go/protocol/triple/triple_protocol/handler_stream_compat.go:103
+0xb0
dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol.(*Handler).ServeHTTP(0x1400047dab0,
{0x102751b40, 0x14000882038}, 0x140007a0f00)
/Users/nyar/go/dubbo-go/protocol/triple/triple_protocol/handler.go:371 +0x8e8
net/http.(*ServeMux).ServeHTTP(0x0?, {0x102751b40, 0x14000882038},
0x140007a0f00)
/opt/homebrew/opt/go/libexec/src/net/http/server.go:2747 +0x1b4
golang.org/x/net/http2.(*serverConn).runHandler(0x0?, 0x0?, 0x14000842b00?,
0x140003d0bf0?)
```
</details>
--
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]