Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Race condition on adding handler specific middlewares #466

Closed
SargtLa opened this issue Aug 8, 2024 · 0 comments · Fixed by #465
Closed

Race condition on adding handler specific middlewares #466

SargtLa opened this issue Aug 8, 2024 · 0 comments · Fixed by #465

Comments

@SargtLa
Copy link
Contributor

SargtLa commented Aug 8, 2024

I face the race condition when I attempted to add new handler with handler level middleware while other process called RunHandlers. Router has a lock for handlers, but not for middlewares.

Here is a sample of a race warning I got:
`WARNING: DATA RACE
Write at 0x00c00060e008 by goroutine 1681:
github.com/ThreeDotsLabs/watermill/message.(*Router).addHandlerLevelMiddleware()
.../github.com/ThreeDotsLabs/watermill/message/router.go:194 +0x3ad
github.com/ThreeDotsLabs/watermill/message.(*Handler).AddMiddleware()
.../github.com/ThreeDotsLabs/watermill/message/router.go:651 +0x22d

Previous read at 0x00c00060e008 by goroutine 1777:
github.com/ThreeDotsLabs/watermill/message.(*Router).RunHandlers.func1()
..../github.com/ThreeDotsLabs/watermill/message/router.go:438 +0xa4`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant