Skip to content

Comments

Fix/service watchdog handling#21

Merged
openwrt-bot merged 2 commits intoopenwrt:masterfrom
tim-nordell-nimbelink:fix/service_watchdog_handling
Feb 9, 2026
Merged

Fix/service watchdog handling#21
openwrt-bot merged 2 commits intoopenwrt:masterfrom
tim-nordell-nimbelink:fix/service_watchdog_handling

Conversation

@tim-nordell-nimbelink
Copy link
Contributor

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 start while 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.

@dangowrt dangowrt force-pushed the fix/service_watchdog_handling branch from c946161 to 1837bb0 Compare February 9, 2026 11:18
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>
@dangowrt dangowrt force-pushed the fix/service_watchdog_handling branch from 1837bb0 to afa4391 Compare February 9, 2026 11:36
@openwrt-bot openwrt-bot merged commit afa4391 into openwrt:master Feb 9, 2026
1 check failed
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.

2 participants