diff options
author | Keith Bostic <keith.bostic@mongodb.com> | 2016-08-14 21:24:08 -0400 |
---|---|---|
committer | Alex Gorrod <alexander.gorrod@mongodb.com> | 2016-08-15 11:24:08 +1000 |
commit | 5c6a3c1e7be7a23eebd731ff5a3e70a97c051ff0 (patch) | |
tree | bc958c9e1b0963fd573da62c2c8cba960a8b7cfa /src/conn | |
parent | 74d7c06233ce4a2c9033e2ad07a69985574724cb (diff) | |
download | mongo-5c6a3c1e7be7a23eebd731ff5a3e70a97c051ff0.tar.gz |
WT-2838 Don't free session handles on close if leak memory is configured (#2953)
There are known crashes in __wt_split_stash_discard_all() during
WT_CONNECTION.close.
We've been unable to reproduce them or spot the problem, but it is
also a possibility we're racing inside WiredTiger because there
are operations running in WiredTiger during a MongoDB shutdown.
MongoDB usually configures leak_memory on connection close, extend
the connection's leak-memory semantics to session memory, hoping to
at least make the symptom go away.
Diffstat (limited to 'src/conn')
-rw-r--r-- | src/conn/conn_open.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/src/conn/conn_open.c b/src/conn/conn_open.c index 9c978fed843..8f101d4ec8e 100644 --- a/src/conn/conn_open.c +++ b/src/conn/conn_open.c @@ -186,27 +186,18 @@ __wt_connection_close(WT_CONNECTION_IMPL *conn) } /* - * The session's split stash isn't discarded during normal session close - * because it may persist past the life of the session. Discard it now. + * The session split stash, hazard information and handle arrays aren't + * discarded during normal session close, they persist past the life of + * the session. Discard them now. */ - if ((s = conn->sessions) != NULL) - for (i = 0; i < conn->session_size; ++s, ++i) - __wt_split_stash_discard_all(session, s); - - /* - * The session's hazard pointer memory isn't discarded during normal - * session close because access to it isn't serialized. Discard it - * now. - */ - if ((s = conn->sessions) != NULL) - for (i = 0; i < conn->session_size; ++s, ++i) { - /* - * If hash arrays were allocated, free them now. - */ - __wt_free(session, s->dhhash); - __wt_free(session, s->tablehash); - __wt_free(session, s->hazard); - } + if (!F_ISSET(conn, WT_CONN_LEAK_MEMORY)) + if ((s = conn->sessions) != NULL) + for (i = 0; i < conn->session_size; ++s, ++i) { + __wt_free(session, s->dhhash); + __wt_free(session, s->tablehash); + __wt_split_stash_discard_all(session, s); + __wt_free(session, s->hazard); + } /* Destroy the handle. */ WT_TRET(__wt_connection_destroy(conn)); |