Package: vdirsyncer
Version: 0.16.8-2
Severity: normal

Hi,

I have acticated the provided systemd config to run vdirsyncer as a user
systemd timer:

dzu@krikkit:~$ systemctl --user cat vdirsyncer.timer
# /usr/lib/systemd/user/vdirsyncer.timer
[Unit]
Description=Synchronize vdirs

[Timer]
OnBootSec=5m
OnUnitActiveSec=15m
AccuracySec=5m

[Install]
WantedBy=timers.target
dzu@krikkit:~$

This uses the vdirsyncer.service file in
/usr/lib/systemd/user/vdirsyncer.service provided by the package without any
overrides.

The setup ran fine until the Nextcloud server it syncs against went into
maintenance mode.  Vsync then reports 503 errors that the server cannot be
reached.  In the systemd logs I then see that the process exits with
status=1/FAILURE and is immediately restarted. This log excerpt shows the good
case of running every 20 minutes and then the immediate restarts upon the
problem:

Aug 10 15:15:10 krikkit systemd[3173042]: vdirsyncer.service: Consumed 2.244s
CPU time.
Aug 10 15:35:09 krikkit systemd[3173042]: vdirsyncer.service: Succeeded.
Aug 10 15:35:09 krikkit systemd[3173042]: vdirsyncer.service: Consumed 2.163s
CPU time.
Aug 10 15:55:10 krikkit systemd[3173042]: vdirsyncer.service: Succeeded.
Aug 10 15:55:10 krikkit systemd[3173042]: vdirsyncer.service: Consumed 2.469s
CPU time.
Aug 10 16:15:07 krikkit systemd[3173042]: vdirsyncer.service: Main process
exited, code=exited, status=1/FAILURE
Aug 10 16:15:07 krikkit systemd[3173042]: vdirsyncer.service: Failed with
result 'exit-code'.
Aug 10 16:15:07 krikkit systemd[3173042]: vdirsyncer.service: Consumed 1.744s
CPU time.
Aug 10 16:15:07 krikkit systemd[3173042]: vdirsyncer.service: Scheduled restart
job, restart counter is at 1.
Aug 10 16:15:07 krikkit systemd[3173042]: vdirsyncer.service: Consumed 1.744s
CPU time.
Aug 10 16:15:09 krikkit systemd[3173042]: vdirsyncer.service: Main process
exited, code=exited, status=1/FAILURE
Aug 10 16:15:09 krikkit systemd[3173042]: vdirsyncer.service: Failed with
result 'exit-code'.
Aug 10 16:15:09 krikkit systemd[3173042]: vdirsyncer.service: Consumed 1.674s
CPU time.
Aug 10 16:15:09 krikkit systemd[3173042]: vdirsyncer.service: Scheduled restart
job, restart counter is at 2.
Aug 10 16:15:09 krikkit systemd[3173042]: vdirsyncer.service: Consumed 1.674s
CPU time.
Aug 10 16:15:11 krikkit systemd[3173042]: vdirsyncer.service: Main process
exited, code=exited, status=1/FAILURE
Aug 10 16:15:11 krikkit systemd[3173042]: vdirsyncer.service: Failed with
result 'exit-code'.
Aug 10 16:15:11 krikkit systemd[3173042]: vdirsyncer.service: Consumed 1.550s
CPU time.
Aug 10 16:15:11 krikkit systemd[3173042]: vdirsyncer.service: Scheduled restart
job, restart counter is at 3.
Aug 10 16:15:11 krikkit systemd[3173042]: vdirsyncer.service: Consumed 1.550s
CPU time.
Aug 10 16:15:13 krikkit systemd[3173042]: vdirsyncer.service: Main process
exited, code=exited, status=1/FAILURE
Aug 10 16:15:13 krikkit systemd[3173042]: vdirsyncer.service: Failed with
result 'exit-code'.
Aug 10 16:15:13 krikkit systemd[3173042]: vdirsyncer.service: Consumed 1.473s
CPU time.
Aug 10 16:15:13 krikkit systemd[3173042]: vdirsyncer.service: Scheduled restart
job, restart counter is at 4.
Aug 10 16:15:13 krikkit systemd[3173042]: vdirsyncer.service: Consumed 1.473s
CPU time.


I believe that the "Restart=on-failure" in the unit file is responsible for
that behavior.  I actually do not understand the intention of this statement
for vdirsyncer at all.

In the case I showed above, the reruns were "harmless" because the target host
was not reachable but I also encountered a situation where vdirsyncer exited
after syncing all the sources like this:

Aug 10 22:34:09 krikkit vdirsyncer[2202152]: Syncing dzu_contacts/z-app-
generated--contactsinteraction--recent
Aug 10 22:34:10 krikkit vdirsyncer[2202152]: error: dzu_contacts/z-app-
generated--contactsinteraction--recent: Storage "dzu_contacts_remote/z-app-
generated--contactsinteraction--recent" was completely emptied. If you want to
delete ALL entries on BOTH sides, then use>
Aug 10 22:34:13 krikkit vdirsyncer[2202152]: error: 1 out of 14 tasks failed.
Aug 10 22:34:13 krikkit systemd[3173042]: vdirsyncer.service: Main process
exited, code=exited, status=1/FAILURE
Aug 10 22:34:13 krikkit systemd[3173042]: vdirsyncer.service: Failed with
result 'exit-code'.
Aug 10 22:34:13 krikkit systemd[3173042]: vdirsyncer.service: Consumed 2.244s
CPU time.
Aug 10 22:34:13 krikkit systemd[3173042]: vdirsyncer.service: Scheduled restart
job, restart counter is at 2.
Aug 10 22:34:13 krikkit systemd[3173042]: Stopped Synchronize calendars and
contacts.
Aug 10 22:34:13 krikkit systemd[3173042]: vdirsyncer.service: Consumed 2.244s
CPU time.
Aug 10 22:34:13 krikkit systemd[3173042]: Started Synchronize calendars and
contacts.


In this case vdirsyncer was running continuously and produced a lot of network
traffic.  I was actually only finding this problem because my network provider
sent me a traffic warning as vdirsyncer produced ~4GB of network traffic on
that single day.

I have to admit that I do not know why I ran into the problem with these
"autogenerated contacts" but once I fixed it interactively like described in
the error message, things returned to normal (sorry the log is truncated but
the truncated line contains a suggestion on how to call vdirsyncer to fix the
problem with --force-delete).

So currently I have this local override:

dzu@krikkit:~$ systemctl --user cat vdirsyncer
# /usr/lib/systemd/user/vdirsyncer.service
[Unit]
Description=Synchronize calendars and contacts
Documentation=https://vdirsyncer.readthedocs.org/

[Service]
ExecStart=/usr/bin/vdirsyncer sync
RuntimeMaxSec=3m
Restart=on-failure

# /home/dzu/.config/systemd/user/vdirsyncer.service.d/override.conf
[Service]
Restart=no
dzu@krikkit:~$

I just checked and this override prevents vdirsyncer to run continuously when
the remote host is not reachable.  I still struggle adding a mail notification
in this case, but systemd is sometimes not so easy...

Thanks in advance
  Detlev





-- System Information:
Debian Release: 11.0
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.10.0-3-amd64 (SMP w/8 CPU threads)
Kernel taint flags: TAINT_WARN, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE not
set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages vdirsyncer depends on:
ii  init-system-helpers        1.60
ii  python3                    3.9.2-3
ii  python3-atomicwrites       1.4.0-2
ii  python3-click              7.1.2-1
ii  python3-click-log          0.2.1-2
ii  python3-click-threading    0.4.4-2
ii  python3-requests           2.25.1+dfsg-2
ii  python3-requests-toolbelt  0.9.1-1

vdirsyncer recommends no packages.

Versions of packages vdirsyncer suggests:
pn  python3-requests-oauthlib  <none>
pn  vdirsyncer-doc             <none>

Reply via email to