Closed JAORMX closed 4 months ago
The test TestEventer/two_subscribers_to_topic has a race condition:
TestEventer/two_subscribers_to_topic
❌ TestEventer/two_subscribers_to_topic (10ms) eventer_test.go:192: published event on "a" eventer_test.go:192: published event on "b" eventer_test.go:199: Expected 3 events eventer_test.go:201: awaiting event 0 eventer_test.go:201: awaiting event 1 eventer_test.go:201: awaiting event 2 ================== WARNING: DATA RACE Write at 0x00c0000a8af0 by goroutine 10: runtime.closechan() /opt/hostedtoolcache/go/1.21.5/x64/src/runtime/chan.go:357 +0x0 github.com/stacklok/minder/internal/events_test.TestEventer.func2.2() /home/runner/work/minder/minder/internal/events/eventer_test.go:164 +0x33 runtime.deferreturn() /opt/hostedtoolcache/go/1.21.5/x64/src/runtime/panic.go:477 +0x30 testing.tRunner() /opt/hostedtoolcache/go/1.21.5/x64/src/testing/testing.go:1595 +0x261 testing.(*T).Run.func1() /opt/hostedtoolcache/go/1.21.5/x64/src/testing/testing.go:1648 +0x44 Previous read at 0x00c0000a8af0 by goroutine 147: runtime.chansend() /opt/hostedtoolcache/go/1.21.5/x64/src/runtime/chan.go:160 +0x0 github.com/stacklok/minder/internal/events_test.fakeHandler.func1() /home/runner/work/minder/minder/internal/events/eventer_test.go:64 +0x545 github.com/stacklok/minder/internal/events.(*Eventer).Register.func1() /home/runner/work/minder/minder/internal/events/eventer.go:341 +0x82 github.com/ThreeDotsLabs/watermill/message.(*Router).AddNoPublisherHandler.func1() /home/runner/go/pkg/mod/github.com/!three!dots!labs/watermill@v1.3.5/message/router.go:334 +0x34 github.com/ThreeDotsLabs/watermill/message/router/middleware.CorrelationID.func1() /home/runner/go/pkg/mod/github.com/!three!dots!labs/watermill@v1.3.5/message/router/middleware/correlation.go:34 +0x49 github.com/ThreeDotsLabs/watermill/message/router/middleware.Retry.Middleware-fm.Retry.Middleware.func1() /home/runner/go/pkg/mod/github.com/!three!dots!labs/watermill@v1.3.5/message/router/middleware/retry.go:41 +0x78 github.com/ThreeDotsLabs/watermill/message/router/middleware.poisonQueue.Middleware-fm.poisonQueue.Middleware.func1() /home/runner/go/pkg/mod/github.com/!three!dots!labs/watermill@v1.3.5/message/router/middleware/poison.go:99 +0x13a github.com/stacklok/minder/internal/events.Setup.recordMetrics.func3.1() /home/runner/work/minder/minder/internal/events/eventer.go:206 +0xc9 github.com/ThreeDotsLabs/watermill/components/metrics.HandlerPrometheusMetricsMiddleware.Middleware-fm.HandlerPrometheusMetricsMiddleware.Middleware.func1() /home/runner/go/pkg/mod/github.com/!three!dots!labs/watermill@v1.3.5/components/metrics/handler.go:58 +0x245 github.com/ThreeDotsLabs/watermill/message.(*handler).handleMessage() /home/runner/go/pkg/mod/github.com/!three!dots!labs/watermill@v1.3.5/message/router.go:775 +0x28e github.com/ThreeDotsLabs/watermill/message.(*handler).run.func2() /home/runner/go/pkg/mod/github.com/!three!dots!labs/watermill@v1.3.5/message/router.go:620 +0x4f Goroutine 10 (running) created at: testing.(*T).Run() /opt/hostedtoolcache/go/1.21.5/x64/src/testing/testing.go:1648 +0x845 github.com/stacklok/minder/internal/events_test.TestEventer() /home/runner/work/minder/minder/internal/events/eventer_test.go:161 +0x16e4 testing.tRunner() /opt/hostedtoolcache/go/1.21.5/x64/src/testing/testing.go:1595 +0x261 testing.(*T).Run.func1() /opt/hostedtoolcache/go/1.21.5/x64/src/testing/testing.go:1648 +0x44 Goroutine 147 (finished) created at: github.com/ThreeDotsLabs/watermill/message.(*handler).run() /home/runner/go/pkg/mod/github.com/!three!dots!labs/watermill@v1.3.5/message/router.go:620 +0x42a github.com/ThreeDotsLabs/watermill/message.(*Router).RunHandlers.func1() /home/runner/go/pkg/mod/github.com/!three!dots!labs/watermill@v1.3.5/message/router.go:438 +0xd7 ================== testing.go:1465: race detected during execution of test make: *** [.mk/test.mk:26: test-silent] Error 1
No response
main
We haven't seen this in a while, and we've taken some passes to clean these things up.
Describe the issue
The test
TestEventer/two_subscribers_to_topic
has a race condition:To Reproduce
No response
What version are you using?
main