Skip to content

Conversation

@sonmezonur
Copy link
Member

  • Concurrent write to objFound bool is not thread-safe. Use atomic boolean to avoid data race.

When I run TestExpandSources with the race detector, it shows data race warnings.

go test -race -mod=vendor -count=1 -run="TestExpandSources" ./...

WARNING: DATA RACE
Write at 0x00c0000b673c by goroutine 30:
  github.com/peak/s5cmd/command.expandSources.func1.1()
      .../go/src/github.com/peak/s5cmd/command/expand.go:79 +0x1d5

Previous write at 0x00c0000b673c by goroutine 29:
  github.com/peak/s5cmd/command.expandSources.func1.1()
      .../go/src/github.com/peak/s5cmd/command/expand.go:79 +0x1d5

Goroutine 30 (running) created at:
  github.com/peak/s5cmd/command.expandSources.func1()
      .../go/src/github.com/peak/s5cmd/command/expand.go:65 +0x1e5

Goroutine 29 (finished) created at:
  github.com/peak/s5cmd/command.expandSources.func1()
      .../go/src/github.com/peak/s5cmd/command/expand.go:65 +0x1e5

* Concurrent write to objFound bool is not thread-safe. Use atomic boolean
  to avoid data race.
@sonmezonur sonmezonur requested a review from a team as a code owner July 29, 2021 10:15
@sonmezonur sonmezonur requested review from aykutfarsak and igungor and removed request for a team July 29, 2021 10:15
@sonmezonur sonmezonur merged commit d80fc02 into master Aug 2, 2021
@sonmezonur sonmezonur deleted the atomic_bool branch August 2, 2021 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants