From 8fbf01ca917b7d8f05f774b9d11dbd55d564bd76 Mon Sep 17 00:00:00 2001 From: Ryan Schneider Date: Wed, 3 Aug 2022 21:43:56 -0700 Subject: [PATCH] mdbx: fix possible semaphore exhaustion on cancelled context (#567) --- kv/mdbx/kv_mdbx.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/kv/mdbx/kv_mdbx.go b/kv/mdbx/kv_mdbx.go index f993265da..d8c5b84d5 100644 --- a/kv/mdbx/kv_mdbx.go +++ b/kv/mdbx/kv_mdbx.go @@ -419,12 +419,6 @@ func (db *MdbxKV) BeginRo(ctx context.Context) (txn kv.Tx, err error) { return nil, semErr } - // if context cancelled as we acquire the sempahore, it may succeed without blocking - // in this case we should return - if ctx.Err() != nil { - return nil, ctx.Err() - } - defer func() { if err == nil { db.wg.Add(1)