From 0df5a6c08a4f3ed39f44e8518c24883ab1f43c95 Mon Sep 17 00:00:00 2001 From: pwd123 <46750216+dlscjf151@users.noreply.github.com> Date: Mon, 6 Nov 2023 20:39:10 +0900 Subject: [PATCH] add rollback tx at GetVoteOnHash #8637 (#8660) At `turbo/jsonrpc/bor_snapshot.go:239` creates read only transaction and acquire semaphore but does not rollback or commit transaction and unrelease semaphore lock. Over time, this will result in the locking all of semaphore resources. Any other resources can't acquire semaphore. I added defer function to rollback transaction to release semaphore. --- turbo/jsonrpc/bor_snapshot.go | 1 + 1 file changed, 1 insertion(+) diff --git a/turbo/jsonrpc/bor_snapshot.go b/turbo/jsonrpc/bor_snapshot.go index a6793ceee..7a6ef67f4 100644 --- a/turbo/jsonrpc/bor_snapshot.go +++ b/turbo/jsonrpc/bor_snapshot.go @@ -241,6 +241,7 @@ func (api *BorImpl) GetVoteOnHash(ctx context.Context, starBlockNr uint64, endBl if err != nil { return false, err } + defer tx.Rollback() service := whitelist.GetWhitelistingService()