-
Notifications
You must be signed in to change notification settings - Fork 11
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
fatal error: concurrent map read and map write #95
Comments
Thanks for reporting this. |
I haven't been able to confirm it yet, but when I investigated the crash log, it seems that the panic occurred due to the following cases occurring at the same time. goroutines 23,25, 23 and 25 have the same content.
goroutine 12
Below is the code where we are using github.com/microsoftgraph/msgraph-sdk-go. graphClient, err := msgraphsdk.NewGraphServiceClientWithCredentials(credential, nil)
if err != nil {
return fmt.Errorf("failed to retrieve service principals: %v", err)
}
filter := fmt.Sprintf("appId eq '%v'",clientID)
configuration := &serviceprincipals.ServicePrincipalsRequestBuilderGetRequestConfiguration{
QueryParameters: &serviceprincipals.ServicePrincipalsRequestBuilderGetQueryParameters{
Filter: &filter,
},
}
result, err := graphClient.ServicePrincipals().Get(ctx, configuration) |
Thanks for sharing additional context. |
I delayed to reply. We are using a job queue. Credentials exist in the job. |
Thanks for the additional information. Yes in that context it makes sense that multiple concurrent client initialization might happen, I don't believe there would be a way around. Comparing the dotnet and go implementations I noticed something, they are not identical. the dotnet implementation uses a try add, which means it'll only add the entry if no other is present for the same key the go implementation replaces any existing entry, no matter what. Instead of locking on read, would you mind submitting a PR that checks whether an entry is already present before adding it please? |
I submitted #103 would you do code review that? |
https://github.com/microsoft/kiota-abstractions-go/blob/3afc7e9554bf182dd0cb7c34020df651216133bc/api_client_builder.go#L14C1-L16
https://github.com/microsoft/kiota-abstractions-go/blob/main/serialization/parse_node_factory_registry.go#L46
I found write lock. but, need a read lock?
The text was updated successfully, but these errors were encountered: