1
0
mirror of https://github.com/redis/go-redis.git synced 2025-12-03 18:31:14 +03:00

try to detect the deadlock x2

This commit is contained in:
Nedyalko Dyakov
2025-10-24 23:45:02 +03:00
parent c4ed467a59
commit 9ad62883ff
6 changed files with 69 additions and 9 deletions

View File

@@ -481,7 +481,11 @@ func (hwm *handoffWorkerManager) closeConnFromRequest(ctx context.Context, reque
conn.ClearHandoffState()
if pooler != nil {
pooler.Remove(ctx, conn, err)
// Use RemoveWithoutTurn instead of Remove to avoid freeing a turn that we don't have.
// The handoff worker doesn't call Get(), so it doesn't have a turn to free.
// Remove() is meant to be called after Get() and frees a turn.
// RemoveWithoutTurn() removes and closes the connection without affecting the queue.
pooler.RemoveWithoutTurn(ctx, conn, err)
if internal.LogLevel.WarnOrAbove() {
internal.Logger.Printf(ctx, logs.RemovingConnectionFromPool(conn.GetID(), err))
}