diff --git a/paddle/fluid/operators/distributed/grpc/grpc_server.cc b/paddle/fluid/operators/distributed/grpc/grpc_server.cc index e1ec9884c8c3d64652a671be79722e63df2b8997..9dd02ba3165be8a5d6c20223d416eca609e9e63f 100644 --- a/paddle/fluid/operators/distributed/grpc/grpc_server.cc +++ b/paddle/fluid/operators/distributed/grpc/grpc_server.cc @@ -145,9 +145,9 @@ class RequestGet final : public RequestBase { framework::Variable* invar = nullptr; framework::Variable* outvar = nullptr; - auto* tmp_scope = scope->NewTmpScope(); - request_handler_->Handle(varname, tmp_scope, invar, &outvar, trainer_id, - out_varname, table_name); + tmp_scope_.reset(scope->NewTmpScope()); + request_handler_->Handle(varname, tmp_scope_.get(), invar, &outvar, + trainer_id, out_varname, table_name); VLOG(1) << "before SerializeToByteBuffer"; if (outvar) { @@ -155,13 +155,13 @@ class RequestGet final : public RequestBase { &reply_); } VLOG(1) << "after SerializeToByteBuffer"; - delete tmp_scope; Finish(reply_, &responder_); } protected: sendrecv::VariableMessage request_; ::grpc::ByteBuffer reply_; + std::unique_ptr tmp_scope_; ServerAsyncResponseWriter<::grpc::ByteBuffer> responder_; };