-
Notifications
You must be signed in to change notification settings - Fork 150
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
Struct Group
is not goroutine safe
#296
Comments
Apologies @boazshalom , I missed this issue. I will look into it. |
All good @monde, thank you! |
This issue has been marked stale because there has been no activity within the last 14 days. To keep this issue active, remove the |
Hi @monde, any update please? |
I'll try to carve out some time for this @boazshalom , thanks for the ping. |
@boazshalom I started looking at this and working on a PR. Is your code writing to We added the map named If I were to refactor GroupProfileMap into a All that said, perhaps I should just put a mutex on Would like to get your feedback @boazshalom , hopefully @ymylei can give feedback also. |
@boazshalom @ymylei I think my #268 PR is over kill. I think I will put up a new PR with mutex around https://github.com/okta/okta-sdk-golang/blob/master/okta/groupProfile.go#L60-L65 and also leave a comment about developers making use of |
@monde Based on my reading of https://pkg.go.dev/sync#Map this does seem overkill for this data set. Particularly, I don't see how this data class in particular would need to be made go routine safe by itself, versus this is something which needs larger attention in the library (such as altering this for the UserProfile object as well). @boazshalom I'd be curious if you'd be able to share the use case you're doing which causes you to send the group object into a set of go routines. While I do personally think this type of multi-threaded use behaviour is going to need to be developer managed, I am curious if there's something about the behaviour when we configure the map to merge into the rest of the GroupProfile object which is problematic. |
Describe the bug?
Hi, trying to pass Group to several goroutines, which some of them try to Marshal it, results in
fatal error: concurrent map writes
. It seems like the cause is this, underGroupProfile.MarshalJSON()
:Thanks!
What is expected to happen?
Safely marshal a struct in parallel
What is the actual behavior?
Transient
fatal error: concurrent map writes
Reproduction Steps?
Just marshal in parallel until it happens
Additional Information?
No response
Golang Version
go version go1.18.1 darwin/amd64
SDK Version
v2.12.1
OS version
No response
The text was updated successfully, but these errors were encountered: