mirror of
https://github.com/mailscope/kumomta.git
synced 2026-09-05 18:18:56 +00:00
We've been troubleshooting a lockup on a system with a low core count. What we found in a stack trace was that one of the threads was blocking on the CACHE mutex in the sts logic. That mutex is intended to be short-duration in scope, managing the direct lookup or insertion into the cache, and no more. However, due to the the way that rust scopes the lifetime of the MutexGuard that is acquired from the CACHE, we were holding it across the async DNS operation that is used to validate that a cached policy is still current. This can result in a deadlock on a system with a sufficiently low core count/high enough concurrent volume of traffic to sites with MTA-STS enabled. This commit resolves this by introducing a lookup function that explicitly clones the cached policy without returning a MutexGuard.