Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

svcSearcher problem #1585

Open
CycleMaker opened this issue Oct 22, 2024 · 1 comment
Open

svcSearcher problem #1585

CycleMaker opened this issue Oct 22, 2024 · 1 comment

Comments

@CycleMaker
Copy link

CycleMaker commented Oct 22, 2024

Is your feature request related to a problem? Please describe.
需要加上对svcSearcher的空判断吗,貌似会引发空指针

kitex/pkg/remote/message.go

Lines 189 to 197 in c8843e4

// for single service scenario
if m.targetSvcInfo != nil {
if mt := m.targetSvcInfo.MethodInfo(methodName); mt == nil {
return nil, NewTransErrorWithMsg(UnknownMethod, fmt.Sprintf("unknown method %s", methodName))
}
return m.targetSvcInfo, nil
}
svcInfo := m.svcSearcher.SearchService(svcName, methodName, false)
if svcInfo == nil {

貌似缺少了对svcSearcher的回收

kitex/pkg/remote/message.go

Lines 160 to 176 in c8843e4

func (m *message) zero() {
m.msgType = InvalidMessageType
m.data = nil
m.rpcInfo = nil
m.targetSvcInfo = &emptyServiceInfo
m.rpcRole = -1
m.compressType = NoCompress
m.payloadSize = 0
if m.transInfo != nil {
m.transInfo.Recycle()
m.transInfo = nil
}
for k := range m.tags {
delete(m.tags, k)
}
m.protocol = emptyProtocolInfo
}

Describe the solution you'd like
SpecifyServiceInfo方法加svcSearcher判空;
Zero方法设置svcSearcher为nil

A clear and concise description of what you want to happen.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

@YangruiEmma
Copy link
Member

@CycleMaker Did you encounter a nil pointer problem here during use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants