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

OAuth2ClientCredentialsAuthPlugin: fatal error: concurrent map writes #6769

Closed
eubaranov opened this issue May 29, 2024 · 2 comments · Fixed by #6773
Closed

OAuth2ClientCredentialsAuthPlugin: fatal error: concurrent map writes #6769

eubaranov opened this issue May 29, 2024 · 2 comments · Fixed by #6773
Labels

Comments

@eubaranov
Copy link
Contributor

Short description

Golang version: 1.19
Lib versions the issue detected: v0.53.1, v0.59.0
Occurance: floating (rare and random)

In all occurrences, the last running goroutine stack pointed to the same place - createAuthJWT
Stack trace example report for the v0.53.1 (the trace for v0.59.0 is the same):

goroutine 298 [running]:
github.com/open-policy-agent/opa/plugins/rest.(*oauth2ClientCredentialsAuthPlugin).createAuthJWT(0xc0030eec30, 0xc002ea1890, {0x161e140, 0xc002457560})
/go/pkg/mod/github.com/open-policy-agent/opa@v0.53.1/plugins/rest/auth.go:221 +0x43d
github.com/open-policy-agent/opa/plugins/rest.(*oauth2ClientCredentialsAuthPlugin).requestToken(0xc0030eec30, {0x1cbc420, 0xc0031e4e40})
/go/pkg/mod/github.com/open-policy-agent/opa@v0.53.1/plugins/rest/auth.go:333 +0x385
github.com/open-policy-agent/opa/plugins/rest.(*oauth2ClientCredentialsAuthPlugin).Prepare(0xc0030eec30, 0xc0050b1600)
/go/pkg/mod/github.com/open-policy-agent/opa@v0.53.1/plugins/rest/auth.go:403 +0x187
github.com/open-policy-agent/opa/plugins/rest.(*Config).authPrepare(0xc002accee0?, 0x0?, 0x1722757?)
/go/pkg/mod/github.com/open-policy-agent/opa@v0.53.1/plugins/rest/rest.go:122 +0x48
github.com/open-policy-agent/opa/plugins/rest.Client.Do({0x0, 0x0, {{0xc000cd7020, 0x4}, {0xc0012c4360, 0x1b}, 0x0, 0x0, 0xc000cd7068, 0x0, ...}, ...}, ...)
/go/pkg/mod/github.com/open-policy-agent/opa@v0.53.1/plugins/rest/rest.go:303 +0x745
github.com/open-policy-agent/opa/download.(*Downloader).download(0xc00140e820, {0x1cbc420, 0xc0031e4e40}, {0x1cc2170?, 0xc004814040})
/go/pkg/mod/github.com/open-policy-agent/opa@v0.53.1/download/download.go:301 +0x837
github.com/open-policy-agent/opa/download.(*Downloader).oneShot(0xc00140e820, {0x1cbc420, 0xc0031e4e40})
/go/pkg/mod/github.com/open-policy-agent/opa@v0.53.1/download/download.go:256 +0x85
github.com/open-policy-agent/opa/download.(*Downloader).loop(0xc00140e820, {0x1cbc420, 0xc0031e4e40})
/go/pkg/mod/github.com/open-policy-agent/opa@v0.53.1/download/download.go:219 +0xc9
created by github.com/open-policy-agent/opa/download.(*Downloader).doStart
/go/pkg/mod/github.com/open-policy-agent/opa@v0.53.1/download/download.go:183 +0xca

Steps To Reproduce

N/A - The problem is floating

Expected behavior

oauth2ClientCredentialsAuthPlugin.Claims map protected with some kind of synchronization

Additional context

@eubaranov eubaranov added the bug label May 29, 2024
@srenatus
Copy link
Contributor

createAuthJWT that method looks suspicious in its handling of the claims function argument. Looks like it could be a low-hanging fruit, though, would you be up to contribute a fix? 😃

@eubaranov
Copy link
Contributor Author

yep, sure

eubaranov added a commit to eubaranov/opa that referenced this issue May 30, 2024
eubaranov added a commit to eubaranov/opa that referenced this issue May 30, 2024
Signed-off-by: eubaranov <evgeniy.baranov@deliveryhero.com>
ashutosh-narkar pushed a commit to eubaranov/opa that referenced this issue May 30, 2024
Signed-off-by: eubaranov <evgeniy.baranov@deliveryhero.com>
ashutosh-narkar pushed a commit that referenced this issue May 30, 2024
…flow

Fixes: #6769

Signed-off-by: eubaranov <evgeniy.baranov@deliveryhero.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants