Skip to content

Commit

Permalink
Merge pull request #4250 from dragonchaser/ocis-4088-fix-race-condition
Browse files Browse the repository at this point in the history
Bugfix: Fix race condition
  • Loading branch information
dragonchaser authored Oct 12, 2023
2 parents 9b24c17 + 8ad3c33 commit 2b27cd4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/fix-race-condition.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Fix race condition

We have fixed a race condition when setting the default tracing provider.

https://github.com/cs3org/reva/pull/4250
https://github.com/owncloud/ocis/issues/4088
2 changes: 2 additions & 0 deletions pkg/trace/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ func NewTracerProvider(opts ...Option) trace.TracerProvider {
// SetDefaultTracerProvider sets the default trace provider
func SetDefaultTracerProvider(tp trace.TracerProvider) {
otel.SetTracerProvider(tp)
defaultProvider.mutex.Lock()
defer defaultProvider.mutex.Unlock()
defaultProvider.initialized = true
}

Expand Down

0 comments on commit 2b27cd4

Please sign in to comment.