Allow configuring the daemon inactivity timeout#1240
Open
benaliabderrahmane wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 Nshuts the daemon down after N seconds of inactivity. The default is still 2 hours, so behavior is unchanged unless you ask for it.helpers.wait_for).spawn_daemon()gains aninactivity_timeoutargument; the auto-spawn path keeps the 2 hour default._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.pycovering the new argument and the short-timeout / never-timeout behavior.