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

Race between Progress.Render and Progress.Stop #322

Closed
N-o-Z opened this issue Jun 30, 2024 · 1 comment
Closed

Race between Progress.Render and Progress.Stop #322

N-o-Z opened this issue Jun 30, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@N-o-Z
Copy link

N-o-Z commented Jun 30, 2024

Describe the bug
Reset signal should be done under mutex otherwise there could be a race between the time we call Render which resets the signals and the time we call Stop which uses the context cancellation function

To Reproduce
Run Render in a go routine and then immediately run Stop

Expected behavior
It is not enough to check renderInProgress under mutex, initForRender should happen also under the mutex which will probably resolve this race

Screenshots

WARNING: DATA RACE
Read at 0x00c00033c2b8 by goroutine 43:
  github.com/jedib0t/go-pretty/v6/progress.(*Progress).Stop()
      /home/niro/go/pkg/mod/github.com/jedib0t/go-pretty/v6@v6.5.9/progress/progress.go:288 +0x44
...

Previous write at 0x00c00033c2b8 by goroutine 45:
  github.com/jedib0t/go-pretty/v6/progress.(*Progress).initForRender()
      /home/niro/go/pkg/mod/github.com/jedib0t/go-pretty/v6@v6.5.9/progress/progress.go:319 +0x2b2
  github.com/jedib0t/go-pretty/v6/progress.(*Progress).Render()
      /home/niro/go/pkg/mod/github.com/jedib0t/go-pretty/v6@v6.5.9/progress/render.go:16 +0x54
...

Software (please complete the following information):

  • OS: Ubuntu
  • GoLang Version 1.21
@jedib0t jedib0t added the bug Something isn't working label Sep 1, 2024
@jedib0t jedib0t closed this as completed in c078fb8 Oct 2, 2024
@jedib0t
Copy link
Owner

jedib0t commented Oct 2, 2024

I apologize for the delay. A fix has been delivered for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants