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

Froodian fix data race #17

Merged
merged 2 commits into from
Apr 26, 2019
Merged

Conversation

froodian
Copy link
Contributor

If you add the new test to the code on master and run go test ./... -race -count=1 -timeout=1m -run . you'll see it fail with

WARNING: DATA RACE
Write at 0x00c0000dc380 by goroutine 17:
  github.com/diegobernardes/ttlcache.(*Cache).SetWithTTL()
      /Users/ian/go/src/github.com/diegobernardes/ttlcache/cache.go:140 +0xa0
  github.com/diegobernardes/ttlcache.TestCache_SkipTtlExtensionOnHit_ForRacesAcrossGoroutines.func1.1()
      /Users/ian/go/src/github.com/diegobernardes/ttlcache/cache.go:131 +0x7d

Previous read at 0x00c0000dc380 by goroutine 16:
  github.com/diegobernardes/ttlcache.TestCache_SkipTtlExtensionOnHit_ForRacesAcrossGoroutines.func2.1()
      /Users/ian/go/src/github.com/diegobernardes/ttlcache/cache.go:172 +0x94

this resolves that.

@ReneKroon ReneKroon merged commit 4a025f8 into jellydator:master Apr 26, 2019
ReneKroon pushed a commit that referenced this pull request Apr 26, 2019
@ReneKroon
Copy link
Contributor

Thanks for reporting.

@froodian froodian deleted the froodian-fix-data-race branch April 29, 2019 20:48
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.

2 participants