From 0ff1e64fab2fec7bd36af1b6b919088eaa3fa98a Mon Sep 17 00:00:00 2001 From: Qiao Longfei Date: Mon, 25 Mar 2019 17:53:04 +0800 Subject: [PATCH] fix a bug --- paddle/fluid/operators/distributed/grpc/grpc_server.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/operators/distributed/grpc/grpc_server.cc b/paddle/fluid/operators/distributed/grpc/grpc_server.cc index e1ec9884c8..9dd02ba316 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_; }; -- GitLab