diff options
author | Milind Changire <mchangir@redhat.com> | 2017-02-23 17:58:46 +0530 |
---|---|---|
committer | Raghavendra Talur <rtalur@redhat.com> | 2017-05-31 05:57:36 +0000 |
commit | 86988ace69eefab71eabb54641a7a3cf7c5e6717 (patch) | |
tree | 2079cff3b0edff97d68860006caea4de862f4520 /rpc | |
parent | 6df94e06cc4dcb60756ac49bd751c4cf95999703 (diff) |
rpc: log more about socket disconnects
Log more about the different paths leading to socket disconnect for
ease of debugging.
Log via gf_log_callingfn() in __socket_disconnect() at loglevel
TRACE if socket connection is being torn down.
mainline:
> BUG: 1426125
> Signed-off-by: Milind Changire <mchangir@redhat.com>
> Reviewed-on: https://review.gluster.org/16732
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> 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>
(cherry picked from commit 67a35ac54bfd61a920c1919fbde588a04ac3358a)
Change-Id: I1e551c2d685784b5ec747f481179f64d524c0461
BUG: 1451977
Signed-off-by: Milind Changire <mchangir@redhat.com>
Reviewed-on: https://review.gluster.org/17321
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/rpc-transport/socket/src/socket.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c index fd422dfd967..e393f2704bf 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -724,6 +724,8 @@ __socket_disconnect (rpc_transport_t *this) priv->ot_state, priv->ot_gen, priv->sock); if (priv->sock != -1) { + gf_log_callingfn (this->name, GF_LOG_TRACE, + "tearing down socket connection"); ret = __socket_teardown_connection (this); if (ret) { gf_log (this->name, GF_LOG_DEBUG, @@ -1201,6 +1203,9 @@ socket_event_poll_out (rpc_transport_t *this) ret = __socket_ioq_churn (this); if (ret == -1) { + gf_log (this->name, GF_LOG_TRACE, + "__socket_ioq_churn returned -1; " + "disconnecting socket"); __socket_disconnect (this); } } @@ -2305,7 +2310,8 @@ socket_connect_finish (rpc_transport_t *this) if (ret == -1 && errno != EINPROGRESS) { if (!priv->connect_finish_log) { gf_log (this->name, GF_LOG_ERROR, - "connection to %s failed (%s)", + "connection to %s failed (%s); " + "disconnecting socket", this->peerinfo.identifier, strerror (errno)); priv->connect_finish_log = 1; @@ -2325,7 +2331,8 @@ socket_connect_finish (rpc_transport_t *this) &this->myinfo.sockaddr_len); if (ret == -1) { gf_log (this->name, GF_LOG_WARNING, - "getsockname on (%d) failed (%s)", + "getsockname on (%d) failed (%s) - " + "disconnecting socket", priv->sock, strerror (errno)); __socket_disconnect (this); event = RPC_TRANSPORT_DISCONNECT; @@ -2378,6 +2385,10 @@ socket_event_handler (int fd, int idx, void *data, EINPROGRESS or ENOENT, so nothing more to do, fail reading/writing anything even if poll_in or poll_out is set */ + gf_log ("transport", GF_LOG_DEBUG, + "connect failed with some other error than " + "EINPROGRESS or ENOENT, so nothing more to " + "do; disconnecting socket"); ret = socket_disconnect (this, _gf_false); /* Force ret to be -1, as we are officially done with @@ -2401,7 +2412,7 @@ socket_event_handler (int fd, int idx, void *data, if ((ret < 0) || poll_err) { /* Logging has happened already in earlier cases */ gf_log ("transport", ((ret >= 0) ? GF_LOG_INFO : GF_LOG_DEBUG), - "disconnecting now"); + "EPOLLERR - disconnecting now"); socket_event_poll_err (this); rpc_transport_unref (this); } @@ -2576,6 +2587,7 @@ err: /* All (and only) I/O errors should come here. */ pthread_mutex_lock(&priv->lock); { + gf_log (this->name, GF_LOG_TRACE, "disconnecting socket"); __socket_teardown_connection (this); sys_close (priv->sock); priv->sock = -1; |