From a3c745ace7eb404449e3599b951021133865a628 Mon Sep 17 00:00:00 2001 From: Leo Date: Thu, 19 Nov 2020 12:53:19 +0100 Subject: [PATCH] bridge/pkg/ethereum: remove channel unsubscribes Unsubscribe() does blocking I/O that ignores the runnable context and can block forever: #107 It would appear that removing the Unsubscribe calls is the only way to work around this go-ethereum bug. ghstack-source-id: 93f287efc09be7eb12921a431effb282aea78510 Pull Request resolved: https://github.com/certusone/wormhole/pull/109 --- bridge/pkg/ethereum/watcher.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/bridge/pkg/ethereum/watcher.go b/bridge/pkg/ethereum/watcher.go index 7f74e9b02..acfeb3089 100644 --- a/bridge/pkg/ethereum/watcher.go +++ b/bridge/pkg/ethereum/watcher.go @@ -70,7 +70,6 @@ func (e *EthBridgeWatcher) Run(ctx context.Context) error { if err != nil { return fmt.Errorf("failed to subscribe to token lockup events: %w", err) } - defer tokensLockedSub.Unsubscribe() // Subscribe to guardian set changes guardianSetC := make(chan *abi.AbiLogGuardianSetChanged, 2) @@ -78,7 +77,6 @@ func (e *EthBridgeWatcher) Run(ctx context.Context) error { if err != nil { return fmt.Errorf("failed to subscribe to guardian set events: %w", err) } - defer tokensLockedSub.Unsubscribe() errC := make(chan error) logger := supervisor.Logger(ctx) @@ -167,7 +165,6 @@ func (e *EthBridgeWatcher) Run(ctx context.Context) error { if err != nil { return fmt.Errorf("failed to subscribe to header events: %w", err) } - defer headerSubscription.Unsubscribe() go func() { for {