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

fix DATA RACE when it calls nextIndex() #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

t2y
Copy link

@t2y t2y commented Mar 8, 2024

I found a DATA RACE error when I wrote some test code using mapslice-json.

You can reproduce quickly by invoking a test function included in this PR.

$ go test -race ./.... -run TestConcurrentUnmarshal
==================
WARNING: DATA RACE
Read at 0x0000007e6a28 by goroutine 10:
  github.com/ake-persson/mapslice-json.nextIndex()
      path/to/mapslice-json/mapslice.go:26 +0x127
  github.com/ake-persson/mapslice-json.(*MapItem).UnmarshalJSON()
      path/to/mapslice-json/mapslice.go:76 +0x113
  encoding/json.(*decodeState).literalStore()
      /usr/local/go1.22.0/src/encoding/json/decode.go:854 +0x394a
...

Also, I updated go version and MakeFile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant