gluster-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gluster-devel] [FIXED] Question on rpc_transport_unref


From: Emmanuel Dreyfus
Subject: [Gluster-devel] [FIXED] Question on rpc_transport_unref
Date: Mon, 29 Apr 2013 15:00:05 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

On Sun, Apr 28, 2013 at 03:24:38PM +0200, Emmanuel Dreyfus wrote:
> This explains the reference dropping to 0, but it is odd, I just don't get
> it, it makes no sense:
> 1367153818.291115 server_alloc_frame 0x7f7ff73b6000  7 -> 6

I found the problem: a race condition caused by an unitialized mutex

Here is a patch. I note that in case of failure, there are also memory
leaks in that same function (the data copied by gf_strdup if goto unlock,
for instance)

--- rpc/rpc-transport/socket/src/socket.c.orig
+++ rpc/rpc-transport/socket/src/socket.c
@@ -2471,8 +2471,17 @@
                                                gf_common_mt_rpc_trans_t);
                         if (!new_trans)
                                 goto unlock;
 
+                        ret = pthread_mutex_init(&new_trans->lock, NULL);
+                        if (ret == -1) {
+                                gf_log (this->name, GF_LOG_WARNING,
+                                        "pthread_mutex_init() failed: %s",
+                                        strerror (errno));
+                                close (new_sock);
+                                goto unlock;
+                        }
+
                         new_trans->name = gf_strdup (this->name);
 
                         memcpy (&new_trans->peerinfo.sockaddr, &new_sockaddr,
                                 addrlen);

-- 
Emmanuel Dreyfus
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]