mirror of
https://github.com/wassname/ray.git
synced 2026-07-28 11:25:04 +08:00
Fix crash because of the reference to deleted variable in grpc server call (#5158)
This commit is contained in:
@@ -142,12 +142,15 @@ class ServerCallImpl : public ServerCall {
|
||||
request_, &reply_,
|
||||
[this](Status status, std::function<void()> success,
|
||||
std::function<void()> failure) {
|
||||
// When the handler is done with the
|
||||
// request, tell gRPC to finish this
|
||||
// request.
|
||||
SendReply(status);
|
||||
// These two callbacks must be set before `SendReply`, because `SendReply`
|
||||
// is aysnc and this `ServerCall` might be deleted right after `SendReply`.
|
||||
send_reply_success_callback_ = std::move(success);
|
||||
send_reply_failure_callback_ = std::move(failure);
|
||||
|
||||
// When the handler is done with the request, tell gRPC to finish this request.
|
||||
// Must send reply at the bottom of this callback, once we invoke this funciton,
|
||||
// this server call might be deleted
|
||||
SendReply(status);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user