Problem:Squid - Crashes with BrokenPipeError: [Errno 32] Broken pipe

Problem

Squid crashes on UCS 5 System with the following error in cache.log:

BrokenPipeError: [Errno 32] Broken pipe
Traceback (most recent call last):
 File "/usr/lib/squid/squid_ldap_ntlm_auth", line 649, in <module>
   sys.stdout.write(answer + "\n")
BrokenPipeError: [Errno 32] Broken pipe
Traceback (most recent call last):
Traceback (most recent call last):
 File "/usr/lib/squid/squid_ldap_ntlm_auth", line 596, in <module>
 File "/usr/lib/squid/squid_ldap_ntlm_auth", line 649, in <module>
   data = sys.stdin.buffer.readline()
ConnectionResetError: [Errno 104] Connection reset by peer
   sys.stdout.write(answer + "\n")
BrokenPipeError: [Errno 32] Broken pipe
Traceback (most recent call last):
 File "/usr/lib/squid/squid_ldap_ntlm_auth", line 649, in <module>
   sys.stdout.write(answer + "\n")

Reason

Debian Bug 943692

UCS Bug 56556

Hint

Fixed in Debian with squid Source-Version: 4.9-1

UCS squid version is
Inst squid (4.6-1+deb10u9A~5.0.6.202401091025 Univention Corporate Server:5.0.6-errata/errata506 [amd64])

Package: univention-squid
Version: 13.0.7-3

Workaround

You can try to set the restart policy for squid to always, than squid will be restarted even if it exited with exit code 0:

Create /etc/systemd/system/squid.service.d/override.conf and add the following lines:

[Service]
Restart=always
Mastodon