From 5cd2a1766c456b7b5c29f5182dd28da46fb23079 Mon Sep 17 00:00:00 2001 From: James Date: Sat, 23 Jan 2016 23:37:42 -0500 Subject: [PATCH] HDFS-9687. libhdfs++: potential segfault after teardown. Contributed by Bob Hansen. --- .../src/main/native/libhdfspp/lib/rpc/rpc_connection.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_connection.h b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_connection.h index 26946bc65fc..61d62e9c127 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_connection.h +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_connection.h @@ -205,8 +205,9 @@ void RpcConnectionImpl::FlushPendingRequests() { req->timer().expires_from_now( std::chrono::milliseconds(options_.rpc_timeout)); - req->timer().async_wait(std::bind( - &RpcConnection::HandleRpcTimeout, this, req, _1)); + req->timer().async_wait([shared_this, this, req](const ::asio::error_code &ec) { + this->HandleRpcTimeout(req, ec); + }); asio::async_write(next_layer_, asio::buffer(*payload), [shared_this, this, payload](const ::asio::error_code &ec,