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.
This commit is contained in:
pwd123 2023-11-06 20:39:10 +09:00 committed by GitHub
parent 1185587b20
commit 0df5a6c08a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -241,6 +241,7 @@ func (api *BorImpl) GetVoteOnHash(ctx context.Context, starBlockNr uint64, endBl
if err != nil { if err != nil {
return false, err return false, err
} }
defer tx.Rollback()
service := whitelist.GetWhitelistingService() service := whitelist.GetWhitelistingService()