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

Goroutine data race #99

Closed
jovrum opened this issue May 15, 2018 · 4 comments
Closed

Goroutine data race #99

jovrum opened this issue May 15, 2018 · 4 comments

Comments

@jovrum
Copy link
Contributor

jovrum commented May 15, 2018

Using g10k version 0.4.5 Build time: 2018-03-08_14:56:34 UTC:

% g10k -puppetfile -moduledir modules -cachedir .g10k_cache; echo $?
==================
WARNING: DATA RACE
Read at 0x00c4200d0aa0 by main goroutine:
  github.com/xorpaul/g10k/vendor/github.com/henvic/uilive.(*Writer).Flush()
      /home/andpaul/dev/go/src/github.com/xorpaul/g10k/vendor/github.com/henvic/uilive/writer.go:80 +0x29d
  github.com/xorpaul/g10k/vendor/github.com/henvic/uiprogress.(*Progress).Stop()
      /home/andpaul/dev/go/src/github.com/xorpaul/g10k/vendor/github.com/henvic/uiprogress/progress.go:135 +0xad
  github.com/xorpaul/g10k/vendor/github.com/henvic/uiprogress.Stop()
      /home/andpaul/dev/go/src/github.com/xorpaul/g10k/vendor/github.com/henvic/uiprogress/progress.go:67 +0x4a
  main.resolvePuppetfile()
      /home/andpaul/dev/go/src/github.com/xorpaul/g10k/puppetfile.go:338 +0x202d
  main.main()
      /home/andpaul/dev/go/src/github.com/xorpaul/g10k/g10k.go:237 +0x193c

Previous write at 0x00c4200d0aa0 by goroutine 7:
  github.com/xorpaul/g10k/vendor/github.com/henvic/uiprogress.(*Progress).Listen()
      /home/andpaul/dev/go/src/github.com/xorpaul/g10k/vendor/github.com/henvic/uiprogress/progress.go:89 +0xa9

Goroutine 7 (finished) created at:
  github.com/xorpaul/g10k/vendor/github.com/henvic/uiprogress.(*Progress).Start()
      /home/andpaul/dev/go/src/github.com/xorpaul/g10k/vendor/github.com/henvic/uiprogress/progress.go:127 +0xbe
  github.com/xorpaul/g10k/vendor/github.com/henvic/uiprogress.Start()
      /home/andpaul/dev/go/src/github.com/xorpaul/g10k/vendor/github.com/henvic/uiprogress/progress.go:62 +0x4a
  main.resolvePuppetfile()
      /home/andpaul/dev/go/src/github.com/xorpaul/g10k/puppetfile.go:173 +0x2098
  main.main()
      /home/andpaul/dev/go/src/github.com/xorpaul/g10k/g10k.go:237 +0x193c
==================
Resolving Forge modules (3/3)    0s [====================================================================] 100%
Synced ./Puppetfile with 0 git repositories and 3 Forge modules in 0.0s with git (0.0s sync, I/O 0.0s) and Forge (0.0s query+download, I/O 0.0s) using 50 resolv and 20 extract workers
Found 1 data race(s)
66

Puppetfile

mod 'puppetlabs/stdlib'
mod 'puppetlabs/apt'
mod 'puppet-yum'

Not sure how I ended up in this state, but I can reliably reproduce it on my machine (it's deterministic). It only happens when the specified cache is hot/populated, and -verbose is not specified.

@jovrum
Copy link
Contributor Author

jovrum commented May 15, 2018

I might have a look at it later but I'll need some time to familiarise myself with Go data races and the race detector. Posted the issue up-front in case this is low hanging fruit for someone else. My issue to PR ratio is admittedly poor :)

@xorpaul
Copy link
Owner

xorpaul commented May 15, 2018

What exactly are you doing to reproduce this error?

I've tried it several times with a populated cache and removing and not removing the modules directory, but I can't make g10k throw the error.

The stack trace and the fact that this only happens when not specifying the -verbose parameter proves that the race happens when the henvic/uiprogress submodule tries to print the progress bar into your terminal.

Did you try a different terminal? I'll check if there are updates for this submodule available.

@jovrum
Copy link
Contributor Author

jovrum commented Jun 26, 2018

Thanks!

@xorpaul
Copy link
Owner

xorpaul commented Jun 26, 2018

I still don't know what exactly is going on with the progress bars and this race condition, but the version I'm currently using (https://github.com/xorpaul/uiprogress) does seem to work.

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

No branches or pull requests

2 participants