Skip to content

Commit 1ea5670

Browse files
authored
Widen WAL concurrent-close test waits for loaded runners (#4360)
TestConcurrentCloseWithInFlightAsyncWrites starts eight writers against an async WAL, then gives the first batch one second to show up in LastOffset before it calls Close. It checks that the writers and Close finish within three seconds each. In the Coverage job, which runs the whole repository's tests in one go test invocation, the main loop did not persist its first batch within that second. The test failed on "expected some writes before Close()" before it had exercised the close race it exists to cover. I could not reproduce this locally: 960 runs with 24 concurrent workers and GOMAXPROCS=1 all passed. All three waits now allow ten seconds. They exist to confirm that writes are flowing and to catch a deadlock in Write or Close. A longer bound still catches a real deadlock, and it no longer mistakes a slow runner for one. When the machine is healthy the test finishes as quickly as before, because each wait returns as soon as its condition is met. Flaked in: https://github.com/sei-protocol/sei-chain/actions/runs/33406933387/job/99536713042
1 parent 398513d commit 1ea5670

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎sei-db/wal/wal_test.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ func TestConcurrentCloseWithInFlightAsyncWrites(t *testing.T) {
553553
require.Eventually(t, func() bool {
554554
last, err := changelog.LastOffset()
555555
return err == nil && last > 0
556-
}, 1*time.Second, 10*time.Millisecond, "expected some writes before Close()")
556+
}, 10*time.Second, 10*time.Millisecond, "expected some writes before Close()")
557557

558558
closeDone := make(chan struct{})
559559
closeErr := make(chan error, 1)
@@ -572,7 +572,7 @@ func TestConcurrentCloseWithInFlightAsyncWrites(t *testing.T) {
572572
default:
573573
return false
574574
}
575-
}, 3*time.Second, 10*time.Millisecond, "writers did not exit (possible deadlock)")
575+
}, 10*time.Second, 10*time.Millisecond, "writers did not exit (possible deadlock)")
576576

577577
// Ensure Close() returns too.
578578
require.Eventually(t, func() bool {
@@ -582,7 +582,7 @@ func TestConcurrentCloseWithInFlightAsyncWrites(t *testing.T) {
582582
default:
583583
return false
584584
}
585-
}, 3*time.Second, 10*time.Millisecond, "Close() did not return (possible deadlock)")
585+
}, 10*time.Second, 10*time.Millisecond, "Close() did not return (possible deadlock)")
586586

587587
require.NoError(t, <-closeErr)
588588
}

0 commit comments

Comments
 (0)