Skip to content

runtime: concurrent map reads grow map and corrupt map internals #5179

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

Closed
bradfitz opened this issue Apr 1, 2013 · 2 comments
Closed

runtime: concurrent map reads grow map and corrupt map internals #5179

bradfitz opened this issue Apr 1, 2013 · 2 comments
Milestone

Comments

@bradfitz
Copy link
Contributor

bradfitz commented Apr 1, 2013

The old hashmap allowed concurrent reads.

The new hashmap code didn't, and led to crashes when GOMAXPROCS > 1.

From khr:

-----------
So I think we've found the problem.  It is triggered by two parallel reads to a map.  My
hashmap implementation was assuming that wouldn't happen.  Internally, the hash table is
grown lazily and I was doing a little bit of growing work during each read.  That
growing work can't happen in parallel and causes corruption.

The quick fix is to disable growing work on reads.  I'll try to get that in today.  The
longer fix would be to have some internal synchronization for the growing work.
------------

Several other bugs may or may not be this issue.
@bradfitz
Copy link
Contributor Author

bradfitz commented Apr 1, 2013

Comment 1:

This issue was updated by revision d76f28f.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/8222044

@randall77
Copy link
Contributor

Comment 2:

Should be fixed by revision https://code.google.com/p/go/source/detail?r=af469280a34b

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants