Skip to content

Allow configuring the daemon inactivity timeout#1240

Open
benaliabderrahmane wants to merge 1 commit into
ros2:rollingfrom
benaliabderrahmane:configurable-daemon-timeout
Open

Allow configuring the daemon inactivity timeout#1240
benaliabderrahmane wants to merge 1 commit into
ros2:rollingfrom
benaliabderrahmane:configurable-daemon-timeout

Conversation

@benaliabderrahmane
Copy link
Copy Markdown

Fixes #1239.

The daemon's inactivity timeout was hard-coded to 2 hours. We run robots for days with a large number of nodes, and once the daemon has timed out an occasional ros2 CLI call respawns a node and triggers DDS discovery, which shows up as a CPU spike. This makes the timeout configurable so a single long-lived daemon can be kept around instead.

  • ros2 daemon start --timeout N shuts the daemon down after N seconds of inactivity. The default is still 2 hours, so behavior is unchanged unless you ask for it.
  • A negative value disables the timeout, so the daemon stays up until it is explicitly stopped (same convention as helpers.wait_for).
  • spawn_daemon() gains an inactivity_timeout argument; the auto-spawn path keeps the 2 hour default.
  • Also fixes _ros2_daemon's existing --timeout: a negative value used to make the daemon exit immediately, now it disables the timeout.

This intentionally only affects daemons started explicitly; auto-spawned daemons keep the 2 hour default.

Added test/test_daemon_timeout.py covering the new argument and the short-timeout / never-timeout behavior.

The daemon shuts itself down after a fixed 2 hours of inactivity, after
which the next ros2 command has to respawn it. Expose this as a --timeout
option on `ros2 daemon start` (the default stays 2 hours), and let a
negative value disable the timeout so the daemon keeps running until it is
explicitly stopped.

The value is threaded through spawn_daemon() via a new inactivity_timeout
argument; the auto-spawn path keeps the 2 hour default. This also fixes
_ros2_daemon's existing --timeout, where a negative value used to make the
daemon exit immediately instead of disabling the timeout.

Signed-off-by: Abderahmane BENALI <46283596+benaliabderrahmane@users.noreply.github.com>
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.

ros2 daemon inactivity timeout (2 hours) isn't configurable

1 participant