Skip to content

Commit

Permalink
Fixed session timeout (#1696)
Browse files Browse the repository at this point in the history
Session should not have been expired if FLAGS_session_idle_timeout_secs is zero
  • Loading branch information
dutor committed Feb 2, 2020
1 parent ee78899 commit 2198f10
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion etc/nebula-graphd.conf.default
Expand Up @@ -37,7 +37,7 @@
# Seconds before the idle connections are closed, 0 for never closed
--client_idle_timeout_secs=0
# Seconds before the idle sessions are expired, 0 for no expiration
--session_idle_timeout_secs=60000
--session_idle_timeout_secs=0
# The number of threads to accept incoming connections
--num_accept_threads=1
# The number of networking IO threads, 0 for # of CPU cores
Expand Down
2 changes: 1 addition & 1 deletion src/graph/GraphFlags.cpp
Expand Up @@ -10,7 +10,7 @@
DEFINE_int32(port, 3699, "Nebula Graph daemon's listen port");
DEFINE_int32(client_idle_timeout_secs, 0,
"Seconds before we close the idle connections, 0 for infinite");
DEFINE_int32(session_idle_timeout_secs, 600,
DEFINE_int32(session_idle_timeout_secs, 0,
"Seconds before we expire the idle sessions, 0 for infinite");
DEFINE_int32(session_reclaim_interval_secs, 10, "Period we try to reclaim expired sessions");
DEFINE_int32(num_netio_threads, 0,
Expand Down
4 changes: 4 additions & 0 deletions src/graph/SessionManager.cpp
Expand Up @@ -81,6 +81,10 @@ int64_t SessionManager::newSessionId() {

// TODO(dutor) Now we do a brute-force scanning, of course we could make it more efficient.
void SessionManager::reclaimExpiredSessions() {
if (FLAGS_session_idle_timeout_secs == 0) {
return;
}

folly::RWSpinLock::WriteHolder holder(rwlock_);
if (activeSessions_.empty()) {
return;
Expand Down

0 comments on commit 2198f10

Please sign in to comment.