diff options
| author | Mohammed Rafi KC <rkavunga@redhat.com> | 2019-01-23 21:55:01 +0530 | 
|---|---|---|
| committer | mohammed rafi kc <rkavunga@redhat.com> | 2019-02-12 07:05:58 +0000 | 
| commit | 34e6028e4ceaff5ceb1165317a3a90d02e0da4ac (patch) | |
| tree | f7a779af63751ee2f94407ae343c8c086ad58259 /rpc/rpc-lib/src | |
| parent | ecd1b4f700ea7a32cc4b46c633f88db7901ff320 (diff) | |
clnt/rpc: ref leak during disconnect.
During disconnect cleanup, we are not cancelling reconnect
timer, which causes a ref leak each time when a disconnect
happen.
Change-Id: I9d05d1f368d080e04836bf6a0bb018bf8f7b5b8a
updates: bz#1659708
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
Diffstat (limited to 'rpc/rpc-lib/src')
| -rw-r--r-- | rpc/rpc-lib/src/rpc-clnt.c | 11 | 
1 files changed, 10 insertions, 1 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c index 3f7bb3ca513..6f47515a48b 100644 --- a/rpc/rpc-lib/src/rpc-clnt.c +++ b/rpc/rpc-lib/src/rpc-clnt.c @@ -495,6 +495,7 @@ rpc_clnt_connection_cleanup(rpc_clnt_connection_t *conn)      int unref = 0;      int ret = 0;      gf_boolean_t timer_unref = _gf_false; +    gf_boolean_t reconnect_unref = _gf_false;      if (!conn) {          goto out; @@ -514,6 +515,12 @@ rpc_clnt_connection_cleanup(rpc_clnt_connection_t *conn)                  timer_unref = _gf_true;              conn->timer = NULL;          } +        if (conn->reconnect) { +            ret = gf_timer_call_cancel(clnt->ctx, conn->reconnect); +            if (!ret) +                reconnect_unref = _gf_true; +            conn->reconnect = NULL; +        }          conn->connected = 0;          conn->disconnected = 1; @@ -533,6 +540,8 @@ rpc_clnt_connection_cleanup(rpc_clnt_connection_t *conn)      if (timer_unref)          rpc_clnt_unref(clnt); +    if (reconnect_unref) +        rpc_clnt_unref(clnt);  out:      return 0;  } @@ -830,7 +839,7 @@ rpc_clnt_handle_disconnect(struct rpc_clnt *clnt, rpc_clnt_connection_t *conn)      pthread_mutex_lock(&conn->lock);      {          if (!conn->rpc_clnt->disabled && (conn->reconnect == NULL)) { -            ts.tv_sec = 10; +            ts.tv_sec = 3;              ts.tv_nsec = 0;              rpc_clnt_ref(clnt);  | 
