Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

fix newPendingTransactions subscription deadlock issue #933

Merged
merged 4 commits into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (evm) [tharsis#871](https://github.com/tharsis/ethermint/pull/871) Set correct nonce in `EthCall` and `EstimateGas` grpc query.
* (rpc) [tharsis#878](https://github.com/tharsis/ethermint/pull/878) Workaround to make GetBlock RPC api report correct block gas used.
* (rpc) [tharsis#900](https://github.com/tharsis/ethermint/pull/900) newPendingTransactions filter return ethereum tx hash.
* (rpc) [tharsis#933](https://github.com/tharsis/ethermint/pull/933) Fix newPendingTransactions subscription deadlock
crypto-facs marked this conversation as resolved.
Show resolved Hide resolved

## [v0.9.0] - 2021-12-01

Expand Down
6 changes: 5 additions & 1 deletion rpc/websockets.go
Original file line number Diff line number Diff line change
Expand Up @@ -712,8 +712,12 @@ func (api *pubSubAPI) subscribePendingTransactions(wsConn *wsConn) (rpc.ID, erro
api.logger.Debug("error writing header, will drop peer", "error", err.Error())

try(func() {
api.filtersMu.RUnlock()
crypto-facs marked this conversation as resolved.
Show resolved Hide resolved
api.filtersMu.Lock()
defer api.filtersMu.Unlock()
defer func() {
api.filtersMu.Unlock()
api.filtersMu.RLock()
}()

if err != websocket.ErrCloseSent {
_ = wsSub.wsConn.Close()
Expand Down