summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorN Balachandran <nbalacha@redhat.com>2016-07-08 10:46:46 +0530
committerJeff Darcy <jdarcy@redhat.com>2016-07-08 13:17:12 -0700
commit9886d568a7a8839bf3acc81cb1111fa372ac5270 (patch)
treea63920aa64867d2f38672356964479f20c8ca57d /rpc
parent84e9fc2fb5fabf9d1e553a420854a306cdb8a168 (diff)
rpc/socket: pthread resources are not cleaned up
A socket_connect failure creates a new pthread which is not a detached thread. As no pthread_join is called, the thread resources are not cleaned up causing a memory leak. Now, socket_connect creates a detached thread to handle failure. Change-Id: Idbf25d312f91464ae20c97d501b628bfdec7cf0c BUG: 1343374 Signed-off-by: N Balachandran <nbalacha@redhat.com> Reviewed-on: http://review.gluster.org/14875 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'rpc')
-rw-r--r--rpc/rpc-transport/socket/src/socket.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
index 7229d0e..e4f72cd 100644
--- a/rpc/rpc-transport/socket/src/socket.c
+++ b/rpc/rpc-transport/socket/src/socket.c
@@ -3142,11 +3142,13 @@ err:
arg->this = THIS;
arg->trans = this;
arg->refd = refd;
- th_ret = pthread_create (&th_id, NULL, socket_connect_error_cbk,
- arg);
+ th_ret = gf_thread_create_detached (&th_id,
+ socket_connect_error_cbk,
+ arg);
if (th_ret) {
- gf_log (this->name, GF_LOG_ERROR, "pthread_create"
- "failed: %s", strerror(errno));
+ /* Error will be logged by gf_thread_create_attached */
+ gf_log (this->name, GF_LOG_ERROR, "Thread creation "
+ "failed");
GF_FREE (arg);
GF_ASSERT (0);
}