Hello Tim,
I have created a new version of apt-cacher-ng for our infrastructure
using the last version of your patch and can confirm that all observed
issues are now resolved, too.
Our infrastructure currently consists of 38 locations. At each location
there is a server with apt-cacher-ng installed. Each server is accessed
by 5 - 40 apt-clients in the middle of the night in the same second. As
a result, the race conditions occurred regularly (daily) for us.
Now everything runs without problems. Without this patch, apt-cacher-ng
was unusable for us. Different errors occurred every day (from
apt-client hangs to signature errors). I wouldn't be surprised if this
patch also fixes other reported bugs.
It's really a pitty that apt-cacher-ng is currently not maintained.
Best Regards,
Arndt