fix: fill up RPC config when seqID==0 (fix issue_1897) #1908
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
fix
Check the PR title.
(Optional) Translate the PR title into Chinese.
当seqID==0时传入一个空的配置,避免出现panic
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en:
zh(optional):
server和client同时启动多路复用,关闭server服务时client会触发panic #1897
源码路径: kitex/pkg/remote/trans/netpollmux/mux_conn.go
ri := rpcinfo.NewRPCInfo(nil, nil, iv, nil, nil) // 关键点:第 4 个参数 config 为 nil
在这里,为了解码控制帧,代码创建了一个临时的 RPCInfo 实例 (ri)。关键在于,NewRPCInfo 的第四个参数 config 被传入了 nil。这意味着这个临时 Message 的 RPCInfo 中 Config() 返回的是 nil。
3. 解码调用链: 接着,代码调用 defaultCodec.Decode(ctx, msg, bufReader)。Decode 内部会调用 DecodePayload。
源码路径: kitex/pkg/remote/codec/default_codec.go
// kitex/pkg/remote/codec/default_codec.go:256
// kitex/pkg/remote/codec/default_codec.go:234
源码路径: kitex/pkg/remote/payload_codec.go
// kitex/pkg/remote/payload_codec.go:36
(Optional) Which issue(s) this PR fixes:
Fixes #1897
(optional) The PR that updates user documentation: