Failed to abandon session scope, ignoring: Connection timed out

One of my systems on nixos 24.05 hangs on a reboot from time to time. So far it only happend after running for a few days.

On reboot there is a message in the journal from systemd-logind: Failed to abandon session scope, ignoring: Connection timed out followed by messages from telegraf that collects metrics.

When it occurs you can ping but cannot connect to the system. Also the connected keyboard is not recognized. It is needed to press the power-button.

Any ideas what is the cause?

Jun 19 14:47:23 test1 sudo[53601]: pam_unix(sudo:session): session opened for user root(uid=0) by testxyz(uid=1000)
Jun 19 14:47:23 test1 systemd-logind[774]: The system will reboot now!
Jun 19 14:47:23 test1 systemd-logind[774]: System is rebooting.
Jun 19 14:47:23 test1 sudo[53601]: pam_unix(sudo:session): session closed for user root
Jun 19 14:47:23 test1 systemd[1]: Stopping Session 8 of User testxyz...
Jun 19 14:47:23 test1 sshd[50258]: pam_unix(sshd:session): session closed for user testxyz
Jun 19 14:47:48 test1 systemd-logind[774]: Failed to abandon session scope, ignoring: Connection timed out
Jun 19 14:47:48 test1 systemd-logind[774]: Session 8 logged out. Waiting for processes to exit.
Jun 19 14:47:49 test1 telegraf[1178]: 2024-06-19T12:47:49Z E! [inputs.systemd_units] Error in plugin: listing loaded units failed: context deadline exceeded
Jun 19 14:48:07 test1 telegraf[1178]: 2024-06-19T12:48:07Z E! [inputs.systemd_units] Error in plugin: listing loaded units failed: context deadline exceeded
Jun 19 14:48:27 test1 telegraf[1178]: 2024-06-19T12:48:27Z E! [inputs.systemd_units] Error in plugin: listing loaded units failed: context deadline exceeded
Jun 19 14:48:47 test1 telegraf[1178]: 2024-06-19T12:48:47Z E! [inputs.systemd_units] Error in plugin: listing loaded units failed: context deadline exceeded
Jun 19 14:49:05 test1 telegraf[1178]: 2024-06-19T12:49:05Z E! [inputs.systemd_units] Error in plugin: listing loaded units failed: context deadline exceeded
Jun 19 14:49:11 test1 sshd[53609]: Connection closed by authenticating user testxyz 10.0.100.1 port 61139 [preauth]
Jun 19 14:49:25 test1 telegraf[1178]: 2024-06-19T12:49:25Z E! [inputs.systemd_units] Error in plugin: listing loaded units failed: context deadline exceeded
Jun 19 14:49:37 test1 sshd[53615]: Connection closed by authenticating user testxyz 10.0.100.1 port 43356 [preauth]
Jun 19 14:49:45 test1 telegraf[1178]: 2024-06-19T12:49:45Z E! [inputs.systemd_units] Error in plugin: listing loaded units failed: context deadline exceeded
Jun 19 14:50:09 test1 telegraf[1178]: 2024-06-19T12:50:09Z E! [inputs.systemd_units] Error in plugin: listing loaded units failed: context deadline exceeded
Jun 19 14:50:25 test1 telegraf[1178]: 2024-06-19T12:50:25Z E! [inputs.systemd_units] Error in plugin: listing loaded units failed: context deadline exceeded
Jun 19 14:50:48 test1 telegraf[1178]: 2024-06-19T12:50:48Z E! [inputs.systemd_units] Error in plugin: listing loaded units failed: context deadline exceeded
Jun 19 14:51:06 test1 telegraf[1178]: 2024-06-19T12:51:06Z E! [inputs.systemd_units] Error in plugin: listing loaded units failed: context deadline exceeded
Jun 19 14:51:29 test1 telegraf[1178]: 2024-06-19T12:51:29Z E! [inputs.systemd_units] Error in plugin: listing loaded units failed: context deadline exceeded
Jun 19 14:51:48 test1 telegraf[1178]: 2024-06-19T12:51:48Z E! [inputs.systemd_units] Error in plugin: listing loaded units failed: context deadline exceeded
Jun 19 14:52:05 test1 telegraf[1178]: 2024-06-19T12:52:05Z E! [inputs.systemd_units] Error in plugin: listing loaded units failed: context deadline exceeded