From 75890f77df2c07ebb43936b09dc0ba1aa56f31b8 Mon Sep 17 00:00:00 2001 From: devopsbo3 <69951731+devopsbo3@users.noreply.github.com> Date: Fri, 10 Nov 2023 12:27:53 -0600 Subject: [PATCH] Revert "eth/filters: fix flaky test TestPendingTxFilterDeadlock (#28376)" This reverts commit 492977c6714e0450c9172800d4db845af6d8eadd. --- eth/filters/filter_system_test.go | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/eth/filters/filter_system_test.go b/eth/filters/filter_system_test.go index f7e5327c56..b5d716ae59 100644 --- a/eth/filters/filter_system_test.go +++ b/eth/filters/filter_system_test.go @@ -915,14 +915,10 @@ func TestPendingTxFilterDeadlock(t *testing.T) { // Create a bunch of filters that will // timeout either in 100ms or 200ms - subs := make([]*Subscription, 20) - for i := 0; i < len(subs); i++ { + fids := make([]rpc.ID, 20) + for i := 0; i < len(fids); i++ { fid := api.NewPendingTransactionFilter(nil) - f, ok := api.filters[fid] - if !ok { - t.Fatalf("Filter %s should exist", fid) - } - subs[i] = f.s + fids[i] = fid // Wait for at least one tx to arrive in filter for { hashes, err := api.GetFilterChanges(fid) @@ -936,13 +932,21 @@ func TestPendingTxFilterDeadlock(t *testing.T) { } } - // Wait until filters have timed out and have been uninstalled. - for _, sub := range subs { - select { - case <-sub.Err(): - case <-time.After(1 * time.Second): - t.Fatalf("Filter timeout is hanging") + // Wait until filters have timed out + time.Sleep(3 * timeout) + + // If tx loop doesn't consume `done` after a second + // it's hanging. + select { + case done <- struct{}{}: + // Check that all filters have been uninstalled + for _, fid := range fids { + if _, err := api.GetFilterChanges(fid); err == nil { + t.Errorf("Filter %s should have been uninstalled\n", fid) + } } + case <-time.After(1 * time.Second): + t.Error("Tx sending loop hangs") } }