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

[Bug] Data races between initDecoder and initEncoder operations #529

Closed
sunadoi opened this issue Dec 17, 2024 · 4 comments · Fixed by #531
Closed

[Bug] Data races between initDecoder and initEncoder operations #529

sunadoi opened this issue Dec 17, 2024 · 4 comments · Fixed by #531

Comments

@sunadoi
Copy link
Contributor

sunadoi commented Dec 17, 2024

In v0.10.4, A data race condition has been detected when running tests with -race flag.

スクリーンショット 2024-12-17 22 31 41

I suspect the following is occurring from this PR (#490 ):

  • runtime.AnalyzeTypeAddr() is being called in both initDecoder and initEncoder.
  • Although using sync.Once, since initEncoderOnce and initDecoderOnce are separate variables, concurrent calls to initEncoder and initDecoder result in race conditions in runtime.AnalyzeTypeAddr() operations.

In our project, tests that simultaneously use json.Marshal and json.Unmarshal have become flaky.

@vincentserpoul
Copy link

I also have the same issue

@lrweck
Copy link

lrweck commented Dec 19, 2024

same

@goccy
Copy link
Owner

goccy commented Dec 20, 2024

@toddtreece It seems that your PR caused a regression. I'm currently unable to allocate time to address this, so could you please handle it ?

@toddtreece
Copy link
Contributor

toddtreece commented Dec 20, 2024

@goccy yes, sorry about missing that. i will open a PR to address it tomorrow morning

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 a pull request may close this issue.

5 participants