Skip to content

fix: race condition in server mode - #209

Merged
caarlos0 merged 1 commit into
mainfrom
race
Aug 1, 2023
Merged

caarlos0 merged 1 commit into
mainfrom
race

Conversation

@caarlos0

@caarlos0 caarlos0 commented Aug 1, 2023

Copy link
Copy Markdown
Contributor

sync.RWMutex allows concurrent reads, which apparently the inner bytes.Buffer don't, and wishlist was triggering sometimes.

So, changing to a sync.Mutex thus locking all ops fixes it.

Thanks @aymanbagabas for reporting this!

This fixes a race condition, I don't fully understand why though.
@caarlos0 caarlos0 added the bug Something isn't working label Aug 1, 2023
@caarlos0
caarlos0 requested a review from aymanbagabas August 1, 2023 15:25
@caarlos0 caarlos0 self-assigned this Aug 1, 2023
@caarlos0
caarlos0 merged commit 5232ef0 into main Aug 1, 2023
@caarlos0
caarlos0 deleted the race branch August 1, 2023 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

⌂ 换网址