Fix/service watchdog handling#21
Merged
openwrt-bot merged 2 commits intoopenwrt:masterfrom Feb 9, 2026
Merged
Conversation
c946161 to
1837bb0
Compare
The instance_config_move(...) function copies the settings from a newly
constructed instance from a "ubus call service set {...}" call into
a prior instance. The `in->watchdog.timeout` is of the type
`struct uloop_timeout` which contains a `struct list` inside of it. This
list is a linked list structure, so when the uloop_timeout is already
in the linked list, this overwrites this particular location with a NULL
pointer for the next/prev entries. This causes procd to crash.
This crash occurs every time "ubus call service set {...}" is called (e.g.
via /etc/init.d/SERVICE start) when a daemon is using the "watchdog"
feature has already been started.
Fixes: 28be011 ("instance: make sure values are not inherited from previous runs")
Signed-off-by: Tim Nordell <tnordell@airgain.com>
When the ubus call "ubus call service watchdog" is used, it's expected that the service might change its watchdog values during runtime when it pets the watchdog. The instance restarting behavior was setup though to restart the instance if these changed. This causes any service which adjusts its watchdog to be restarted via "/etc/init.d/SERVICENAME start" which is probably not what was intended. Introduce a new variable, self_managed, if the service adjusted these values at runtime so that a "start" doesn't cause the entire service to restart. Signed-off-by: Tim Nordell <tnordell@airgain.com>
1837bb0 to
afa4391
Compare
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.
There are a couple of commits in this series - notably the first one fixes a crash in procd that occurs if a service is using a watchdog and you invoke
/etc/init.d/SERVICENAME startwhile it's already started.The second commit in the series fixes more of an annoyance than anything else. There's a separate API call to manage the watchdog for a running service, like petting the watchdog. It supports adjusting the watchdog parameters away from what the init script set. Presumably if that was used, any of the initial startup settings in the init script are mainly to guard against the starting up of the daemon instead of guarding the runtime. This simply marks a "self_managed" attribute when this occurs, and ignores that as a configuration changed when/if that occurs.