[systemd-devel] sd_bus_process() - ECONNRESET due to bus timeout?
Al Chu
chu11 at llnl.gov
Tue Jan 11 12:29:36 UTC 2022
Hi,
I have a bit of a code that loosely does the following:
- setup a "org.freedesktop.DBus.Properties" / "PropertiesChanged"
callback via `sd_bus_match_signal_async()`
- through a file descriptor event reactor, watch the file descriptor
returned by `sd_bus_get_fd()`.
- when I see file descriptor activity, call `sd_bus_process()` in a
loop as described in the manpage.
- in the callback determine if the process has exited, check exit code,
etc. and handle as needed.
I've noticed that my code works fine for a process that runs < ~25
seconds, but for tasks that run longer than 25 seconds,
`sd_bus_process()` returns ECONNRESET.
I can't help but wonder if the default BUS_DEFAULT_TIMEOUT of 25
seconds is in play here. I'm on Centos 8 which is at systemd v239,
which unfortunately does not seem to support SYSTEMD_BUS_TIMEOUT or
`sd_bus_set_method_call_timeout()` (AFAICT v240 is when they were
added).
I'm wondering if I'm just missing some subtlety on how to get this to
work.
- Am I simply required to re-establish the connection when I get
ECONNRESET? I thought this possible, but 25 seconds seems somewhat
short and callers would just regularly miss changes they want to see.
- Is there some "keepalive" NOOP to be done?
- Is the bus timeout affecting me and I will have to use a newer
systemd version?
Thanks,
Al
--
Albert Chu
chu11 at llnl.gov
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory
More information about the systemd-devel
mailing list