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
bontibon opened this issue Jun 13, 2018 · 4 comments
Closed

image: RegisterFormat is not thread safe #25884

bontibon opened this issue Jun 13, 2018 · 4 comments

Comments

@bontibon
Copy link
Contributor

@bontibon bontibon 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

@gopherbot gopherbot commented Jun 14, 2018

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

Loading

@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Jun 14, 2018

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.

Loading

@bontibon
Copy link
Contributor Author

@bontibon bontibon commented Jun 14, 2018

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

Loading

@rsc
Copy link
Contributor

@rsc 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.

Loading

@rsc rsc added the NeedsFix label Sep 26, 2018
@gopherbot gopherbot closed this in 10aeb67 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.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants