[Bug 13463] Please consider using the IP_FREEBIND socket option

just subscribed for rsync-qa from bugzilla via rsync <[email protected]>
Newsgroups gmane.network.rsync.general
Message-ID <[email protected]/>
https://bugzilla.samba.org/show_bug.cgi?id=13463

--- Comment #3 from Andreas Hasenack <[email protected]> ---
Thanks for all the opinions. I have one remaining issue, and that is with
"systemctl start rsync.service" not detecting the failure right away.

The systemd unit file calls rsync like this:

[Service]
ExecStart=/usr/bin/rsync --daemon --no-detach

This is correct, specially the --no-detach option. systemd should be able to
tell immediately if the service started or not, but according to the
systemd.service manpage, it will signal success in any case for type=simple
services. It's not much better for type=exec.

If I run rsync with an invalid config, it exits non-zero right away:

root@j1-rsyncd:~# rsync --daemon --no-detach ; echo $?
10


But via systemctl, it exits 0:
root@j1-rsyncd:~# systemctl start rsync; echo $?
0

root@j1-rsyncd:~# systemctl status rsync
× rsync.service - fast remote file copy program daemon
     Loaded: loaded (/lib/systemd/system/rsync.service; disabled; vendor
preset: enabled)
     Active: failed (Result: exit-code) since Wed 2022-03-30 19:10:03 UTC; 3s
ago
       Docs: man:rsync(1)
             man:rsyncd.conf(5)
    Process: 4305 ExecStart=/usr/bin/rsync --daemon --no-detach (code=exited,
status=10)
   Main PID: 4305 (code=exited, status=10)
        CPU: 3ms

Mar 30 19:10:03 j1-rsyncd rsyncd[4305]: bind() failed: Cannot assign requested
address (address-family 2)
Mar 30 19:10:03 j1-rsyncd systemd[1]: Started fast remote file copy program
daemon.
Mar 30 19:10:03 j1-rsyncd rsyncd[4305]: unable to bind any inbound sockets on
port 873
Mar 30 19:10:03 j1-rsyncd systemd[1]: rsync.service: Main process exited,
code=exited, status=10/n/a
Mar 30 19:10:03 j1-rsyncd rsyncd[4305]: rsync error: error in socket IO (code
10) at socket.c(545) [Receiver=3.2.3]
Mar 30 19:10:03 j1-rsyncd systemd[1]: rsync.service: Failed with result
'exit-code'.


This seems to be the norm for this type of systemd service (type=simple,
type=exec), and looks like the most reliable way to have systemctl start detect
immediately if the service failed or not would be to implement systemd's
notify[1] mechanism in rsync.

Type=forking might be an alternative, but this timeout would have to be tuned:

root@j1-rsyncd:~# time systemctl start rsync
Job for rsync.service failed because a timeout was exceeded.
See "systemctl status rsync.service" and "journalctl -xeu rsync.service" for
details.

real    1m30.246s


With TimeoutStartSec=5 in the unit file:

root@j1-rsyncd:~# time systemctl start rsync
Job for rsync.service failed because a timeout was exceeded.
See "systemctl status rsync.service" and "journalctl -xeu rsync.service" for
details.

real    0m5.287s




1. https://www.freedesktop.org/software/systemd/man/sd_notify.html

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.