Erroneous Go race detection
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- go
- Domain
- backend, testing-qa
Research direction
Start with error_mappings_registry.go around lines 19 and 55, then reproduce the issue by running parallel tests with go test -race. Trace the reported read and write and verify that the package's race-enabled tests complete without false-positive race failures.
Written by the indexing model from the issue text.
Description
Describe the bug
Currently, running parallel tests using this package with race detection on causes false positives of data races:
WARNING: DATA RACE
Read at 0x000005260ee8 by goroutine 11:
github.com/microsoftgraph/msgraph-sdk-go-core.getInstance()
/home/runner/go/pkg/mod/github.com/microsoftgraph/msgraph-sdk-go-core@v1.3.2/error_mappings_registry.go:19 +0x30
github.com/microsoftgraph/msgraph-sdk-go-core.GetErrorFactoryFromRegistry()
/home/runner/go/pkg/mod/github.com/microsoftgraph/msgraph-sdk-go-core@v1.3.2/error_mappings_registry.go:55 +0x2b
...
Previous write at 0x000005260ee8 by goroutine 34:
github.com/microsoftgraph/msgraph-sdk-go-core.getInstance()
/home/runner/go/pkg/mod/github.com/microsoftgraph/msgraph-sdk-go-core@v1.3.2/error_mappings_registry.go:23 +0x12f
github.com/microsoftgraph/msgraph-sdk-go-core.GetErrorFactoryFromRegistry()
/home/runner/go/pkg/mod/github.com/microsoftgraph/msgraph-sdk-go-core@v1.3.2/error_mappings_registry.go:55 +0x2b
The issue seems to be in:
https://github.com/microsoftgraph/msgraph-sdk-go-core/blob/a8bcb6c81e33e77c3d5338337e5da8b8085cd932/error_mappings_registry.go#L19
The optimistic nil check triggers a read-write race detection - perhaps it can be disabled when go test -race is on?
Expected behavior
Go's race detection won't fail tests when using the package in it
How to reproduce
Run tests using the package in parallel with -race specified in go test's arguments.
SDK Version
No response
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
Click to expand log
```</details>
### Configuration
_No response_
### Other information
_No response_
- Dominant language
- Go
- Stars
- 22
- Forks
- 16
- Avg merge
- 7h 53m
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoftgraph/msgraph-sdk-go-core
-
area:authentication goodfirstissue type:enhancement
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
enhancement
microsoftgraph/msgraph-sdk-go-core#267 · 11 comments · 1 reaction · 1 assignee ·
-
microsoftgraph/msgraph-sdk-go-core#250 · 1 comment · 1 assignee ·
-
enhancement
microsoftgraph/msgraph-sdk-go-core#220 · 10 comments · 1 assignee ·
-
blocked enhancement
microsoftgraph/msgraph-sdk-go-core#148 · 6 comments · 1 reaction · 1 assignee ·
All issues in microsoftgraph/msgraph-sdk-go-core
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·