fix: prevent data race on FSCompressedFileSuffixes map#2300
Merged
erikdubbelboer merged 1 commit intoJun 22, 2026
Conversation
erikdubbelboer
requested changes
Jun 22, 2026
erikdubbelboer
left a comment
Collaborator
There was a problem hiding this comment.
I'm sorry but I don't really like changing the API like this. This is something that you're supposed to set in an init() or at the start of main() and then don't change anymore. Instead of all these changes lets just document that. Can you please change this.
…dification FSCompressedFileSuffixes is read during FSHandler initialization (inside a sync.Once). It is not safe for concurrent modification. Add documentation clarifying that custom suffixes should be set in an init() function or before the first FS.NewRequestHandler call, and the map should not be modified afterwards. Fixes valyala#2223
b6e2877 to
fffcb62
Compare
Contributor
Author
|
Updated per your feedback — removed the API changes and just added documentation. The map should be set in |
Collaborator
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update
Per maintainer feedback, simplified this to documentation only. The original approach added
SetCompressedFileSuffix()and async.RWMutex, but @erikdubbelboer pointed out thatFSCompressedFileSuffixesis meant to be set once at startup and not modified concurrently.The fix is now just a doc comment clarifying that the map should be set in
init()or before the firstFS.NewRequestHandlercall, and not modified afterwards.Fixes #2223