Blocking call in phosphor-networkd
yulei.sh at bytedance.com
Wed Oct 19 14:40:17 AEDT 2022
During network testing, we identified an issue in phosphor-networkd
that the service is blocked for a few seconds in refreshObjects().
In future investigation, the blocking happens in
`getHostNameFromSystem()` that tries to get the hostname from
`systemd-hostnamed` is a service that will exit on idle (30s), and
start on request.
So as long as the `systemd-hostnamed` service is inactive, the call in
`getHostNameFromSystem()` will be blocked, waiting for
`systemd-hostnamed` to be started and the hostname is returned. It
takes more than 1s on AST2500 if the BMC is idle, and took more if the
BMC is busy.
When it is blocked, the services making DBus calls to networkd will be
blocked as well, this typically happens when BMC in DHCP refreshes
it's IP address and we notice that ipmid is blocked during this
How about changing the code to read the `/etc/hostname` file directly?
It is much faster than making DBus call to `systemd-hostnamed`.
An alternative is to make async calls, but phosphor-networkd is
written in "sync" way so it may require more effort to change it
Comments are welcome.
More information about the openbmc