Skip to content

feat: dynamic user idle_timeout from patch.cfg without container restart#415

Open
rippleitinnz wants to merge 1 commit into
mainfrom
feat/dynamic-user-idle-timeout-from-patch-cfg
Open

feat: dynamic user idle_timeout from patch.cfg without container restart#415
rippleitinnz wants to merge 1 commit into
mainfrom
feat/dynamic-user-idle-timeout-from-patch-cfg

Conversation

@rippleitinnz
Copy link
Copy Markdown
Contributor

@rippleitinnz rippleitinnz commented May 20, 2026

Problem

user.idle_timeout is only read at startup in usr::init() and cached in
metric_thresholds[4]. It cannot be changed on a running node without a
container restart, which is not possible on leased Evernode instances.

Currently user.idle_timeout defaults to 0 (unlimited) in most deployments.
However operators may wish to set a timeout to protect against stale client
connections consuming resources, or to adjust it dynamically based on workload.
Without this fix, any change to user.idle_timeout requires a full container
restart to take effect.

Fix

Three changes:

comm_server.hpp — added for_each_session() template method to iterate
over all active sessions under mutex protection. Shared with sibling PR
feat/dynamic-mesh-idle-timeout-from-patch-cfg.

usr.cpp — added update_idle_timeout() which updates metric_thresholds[4]
for future connections AND calls set_threshold(IDLE_CONNECTION_TIMEOUT) on all
existing active user sessions via for_each_session().

conf.cpp — reads user.idle_timeout from patch.cfg in apply_patch_config(),
calls usr::update_idle_timeout() when value changes.

Effect

Operators can now update user.idle_timeout via patch.cfg on a running cluster
without any container restart. Takes effect immediately on all active and future
user connections.

Sibling PRs

This is part of a series making some hpcore config fields dynamically updatable from patch.cfg:

These three PRs should be reviewed and merged together. This PR and #414 share
the for_each_session() template added to comm_server.hpp.

When user.idle_timeout is present in patch.cfg, apply_patch_config() now
updates all active user sessions via usr::update_idle_timeout() and also
updates the cached metric_thresholds array for future connections.

Previously user.idle_timeout was only read at startup (usr::init()) and could
not be changed on a running node without a container restart.

Implementation:
- comm_server.hpp: added for_each_session() template to iterate live sessions
  (shared with feat/dynamic-mesh-idle-timeout-from-patch-cfg)
- usr.cpp: added update_idle_timeout() which updates metric_thresholds[4] and
  calls set_threshold(IDLE_CONNECTION_TIMEOUT) on all active user sessions
- conf.cpp: reads user.idle_timeout from patch.cfg in apply_patch_config(),
  calls usr::update_idle_timeout() when value changes

Sibling PRs (part of dynamic config series):
- fix/dynamic-log-level-from-patch-cfg (already raised)
- feat/dynamic-mesh-idle-timeout-from-patch-cfg (already raised)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant