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

bug: fix infinite loop of asyncCallback #230

Merged
merged 2 commits into from
Aug 24, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pkg/remoting/getty/getty_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ func (client *GettyRemotingClient) SendSyncRequest(msg interface{}) (interface{}
}

func (g *GettyRemotingClient) asyncCallback(reqMsg message.RpcMessage, respMsg *message.MessageFuture) (interface{}, error) {
go g.asyncCallback(reqMsg, respMsg)
go func() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里直接改为 go g.syncCallback(reqMsg, respMsg) 就行

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

_, err := g.syncCallback(reqMsg, respMsg)
if err != nil {
log.Errorf("asyncCallback error: {%#v}", err.Error())
}
}()
return nil, nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

两个问题:
1 这个函数的返回值没有任何意义,整体有效代码只有一个异步 goroutine;
2 你这个改动就加了个错误处理,怎么就能停止无限循环,没看明白

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asyncCallback -> syncCallback

}

Expand Down