Repository navigation
Closed
Labels
bug 🐛Programming errors, that need preferential fixing
Description
Version: 241-7
I originally filed this issue downstream as https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=933268 against the rpcbind package, but somehow this smells like it could be a systemd issue.
The rpcbind package ships the following two units:
$ systemctl cat rpcbind.service rpcbind.socket
# /lib/systemd/system/rpcbind.service
[Unit]
Description=RPC bind portmap service
Documentation=man:rpcbind(8)
DefaultDependencies=no
RequiresMountsFor=/run/rpcbind
# Make sure we use the IP addresses listed for
# rpcbind.socket, no matter how this unit is started.
Requires=rpcbind.socket
After=systemd-tmpfiles-setup.service
Wants=remote-fs-pre.target rpcbind.target
Before=remote-fs-pre.target rpcbind.target
[Service]
Environment="OPTIONS=-w"
ExecStart=/sbin/rpcbind -f $OPTIONS
EnvironmentFile=-/etc/rpcbind.conf
EnvironmentFile=-/etc/default/rpcbind
Type=notify
KillMode=process
Restart=on-failure
[Install]
Also=rpcbind.socket
WantedBy=multi-user.target
# /lib/systemd/system/rpcbind.socket
[Unit]
Description=RPCbind Server Activation Socket
DefaultDependencies=no
[Socket]
ListenStream=/run/rpcbind.sock
# RPC netconfig can't handle ipv6/ipv4 dual sockets
BindIPv6Only=ipv6-only
ListenStream=0.0.0.0:111
ListenDatagram=0.0.0.0:111
ListenStream=[::]:111
ListenDatagram=[::]:111
[Install]
WantedBy=sockets.target
Both are running
$ systemctl status rpcbind.service rpcbind.socket
● rpcbind.service - RPC bind portmap service
Loaded: loaded (/lib/systemd/system/rpcbind.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2019-08-06 09:54:14 CEST; 1s ago
Docs: man:rpcbind(8)
Main PID: 14866 (rpcbind)
Tasks: 1 (limit: 4915)
Memory: 656.0K
CGroup: /system.slice/rpcbind.service
└─14866 /sbin/rpcbind -f -w
Aug 06 09:54:14 pluto systemd[1]: Starting RPC bind portmap service...
Aug 06 09:54:14 pluto systemd[1]: Started RPC bind portmap service.
● rpcbind.socket - RPCbind Server Activation Socket
Loaded: loaded (/lib/systemd/system/rpcbind.socket; enabled; vendor preset: enabled)
Active: active (running) since Tue 2019-08-06 09:54:08 CEST; 8s ago
Listen: /run/rpcbind.sock (Stream)
0.0.0.0:111 (Stream)
0.0.0.0:111 (Datagram)
[::]:111 (Stream)
[::]:111 (Datagram)
Tasks: 0 (limit: 4915)
Memory: 188.0K
CGroup: /system.slice/rpcbind.socket
Aug 06 09:54:08 pluto systemd[1]: Listening on RPCbind Server Activation Socket.
Now, trying to restart both will (sometimes) trigger this error:
$ sudo systemctl restart rpcbind.service rpcbind.socket
$ sudo systemctl restart rpcbind.service rpcbind.socket
Job for rpcbind.socket failed.
See "systemctl status rpcbind.socket" and "journalctl -xe" for details.
A dependency job for rpcbind.service failed. See 'journalctl -xe' for details.
michael@pluto:~$ systemctl status rpcbind.service rpcbind.socket
● rpcbind.service - RPC bind portmap service
Loaded: loaded (/lib/systemd/system/rpcbind.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2019-08-06 09:54:59 CEST; 3s ago
Docs: man:rpcbind(8)
Main PID: 14904 (rpcbind)
Tasks: 1 (limit: 4915)
Memory: 496.0K
CGroup: /system.slice/rpcbind.service
└─14904 /sbin/rpcbind -f -w
Aug 06 09:54:59 pluto systemd[1]: Starting RPC bind portmap service...
Aug 06 09:54:59 pluto systemd[1]: Dependency failed for RPC bind portmap service.
Aug 06 09:54:59 pluto systemd[1]: rpcbind.service: Job rpcbind.service/start failed with result 'dependency'.
● rpcbind.socket - RPCbind Server Activation Socket
Loaded: loaded (/lib/systemd/system/rpcbind.socket; enabled; vendor preset: enabled)
Active: inactive (dead) since Tue 2019-08-06 09:54:59 CEST; 3s ago
Listen: /run/rpcbind.sock (Stream)
0.0.0.0:111 (Stream)
0.0.0.0:111 (Datagram)
[::]:111 (Stream)
[::]:111 (Datagram)
Aug 06 09:54:57 pluto systemd[1]: Listening on RPCbind Server Activation Socket.
Aug 06 09:54:59 pluto systemd[1]: rpcbind.socket: Succeeded.
Aug 06 09:54:59 pluto systemd[1]: Closed RPCbind Server Activation Socket.
Aug 06 09:54:59 pluto systemd[1]: Stopping RPCbind Server Activation Socket.
Aug 06 09:54:59 pluto systemd[1]: rpcbind.socket: Socket service rpcbind.service already active, refusing.
Aug 06 09:54:59 pluto systemd[1]: Failed to listen on RPCbind Server Activation Socket.
As you can see, it doesn't happen all the time, but it's relatively easy to trigger. This looks like there is a race condition somewhere.
I tried with v232 on a Debian stretch system and was not able to reproduce the issue there.
Metadata
Metadata
Assignees
Labels
bug 🐛Programming errors, that need preferential fixing
Activity
Werkov commentedon Aug 7, 2019
Yes, there is a race. Multiple jobs issued by systemctl call aren't grouped in the same transaction. I wonder why you didn't see that in v232 though.
BTW is this causing troubles? Would
systemctl stop rpcbind.service && systemctl restart rpcbind.socketwork for you?Edit:
systemctl restart rpcbind.socketshould suffice (thanks to Requires=rpcbind.socket).mbiebl commentedon Aug 7, 2019
If it's a race condition, it's likely I simply didn't hit it on my test system. But I was informed by the maintainer of rpcbind that this problem apparently already existed during stretch upgrades, i.e. with v232.
mbiebl commentedon Aug 7, 2019
It is. See the referenced Debian bug report where the upgrade fails because it uses
systemctl restart rpcbind.service rpcbind.socketpoettering commentedon Aug 31, 2020
Yeah, this is a race, we don't turn this into a single transaction, but two. To change that is tracked in #8102, which means I guess we can close this issue, since there's no need to track this twice.