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

image: RegisterFormat is not thread safe #25884

Closed
ghost opened this issue Jun 13, 2018 · 4 comments
Closed

image: RegisterFormat is not thread safe #25884

ghost opened this issue Jun 13, 2018 · 4 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@ghost
Copy link

ghost commented Jun 13, 2018

As the title says, image.RegisterFormat is not thread safe.

There was a similar issue regarding database/sql.Register (#9847), where the solution was to protect the slice with a Mutex.

@bradfitz bradfitz added this to the Go1.12 milestone Jun 14, 2018
@gopherbot
Copy link

Change https://golang.org/cl/118755 mentions this issue: image: make RegisterFormat safe for concurrent use

@bradfitz bradfitz added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Jun 14, 2018
@bradfitz
Copy link
Contributor

Or we could just document that it's not.

I'm a little surprised that code exists to concurrently register these and it's not just done once early, like from init.

@ghost
Copy link
Author

ghost commented Jun 14, 2018

I would say adding a lock would be preferred, as that would mimic the behaviour of database/sql.Register.

@rsc
Copy link
Contributor

rsc commented Sep 26, 2018

I agree that we should make it thread-safe, like we did for database/sql. There are reasonable non-init-time installations, and even at init time there may be other goroutines.

@rsc rsc added the NeedsFix The path to resolution is known, but the work has not been done. label Sep 26, 2018
@gopherbot gopherbot removed the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Sep 26, 2018
@golang golang locked and limited conversation to collaborators Sep 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants