Skip to content

Instantly share code, notes, and snippets.

@cardil
Created February 8, 2024 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cardil/5762ff149f10fe1d76ddadc8b01c9f8d to your computer and use it in GitHub Desktop.
Save cardil/5762ff149f10fe1d76ddadc8b01c9f8d to your computer and use it in GitHub Desktop.
Race condition on TestProgress (from knative/client-pkg#139)
=== RUN TestProgress
==================
WARNING: DATA RACE
Read at 0x00c00018d700 by goroutine 40:
github.com/charmbracelet/bubbles/progress.(*Model).SetPercent.(*Model).nextFrame.func1()
/home/ksuszyns/git/knative-client-pkg/vendor/github.com/charmbracelet/bubbles/progress/progress.go:285 +0x4f
github.com/charmbracelet/bubbles/progress.(*Model).SetPercent.(*Model).nextFrame.Tick.func2()
/home/ksuszyns/git/knative-client-pkg/vendor/github.com/charmbracelet/bubbletea/commands.go:142 +0x83
github.com/charmbracelet/bubbletea.(*Program).handleCommands.func1.1()
/home/ksuszyns/git/knative-client-pkg/vendor/github.com/charmbracelet/bubbletea/tea.go:294 +0x42
Previous write at 0x00c00018d700 by goroutine 8:
github.com/charmbracelet/bubbles/progress.(*Model).SetPercent()
/home/ksuszyns/git/knative-client-pkg/vendor/github.com/charmbracelet/bubbles/progress/progress.go:248 +0xe4
knative.dev/client-pkg/pkg/output/tui.bubbleProgressHandler.percentChange()
/home/ksuszyns/git/knative-client-pkg/pkg/output/tui/progress.go:180 +0x56
knative.dev/client-pkg/pkg/output/tui.(*BubbleProgress).Update()
/home/ksuszyns/git/knative-client-pkg/pkg/output/tui/progress.go:135 +0x324
knative.dev/client-pkg/pkg/output/tui.bubbleProgressHandler.Update()
<autogenerated>:1 +0x47
github.com/charmbracelet/bubbletea.(*Program).eventLoop()
/home/ksuszyns/git/knative-client-pkg/vendor/github.com/charmbracelet/bubbletea/tea.go:411 +0xa1b
github.com/charmbracelet/bubbletea.(*Program).Run()
/home/ksuszyns/git/knative-client-pkg/vendor/github.com/charmbracelet/bubbletea/tea.go:543 +0xf77
knative.dev/client-pkg/pkg/output/tui.(*BubbleProgress).start.func1()
/home/ksuszyns/git/knative-client-pkg/pkg/output/tui/progress.go:241 +0x64
Goroutine 40 (running) created at:
github.com/charmbracelet/bubbletea.(*Program).handleCommands.func1()
/home/ksuszyns/git/knative-client-pkg/vendor/github.com/charmbracelet/bubbletea/tea.go:293 +0x236
Goroutine 8 (running) created at:
knative.dev/client-pkg/pkg/output/tui.(*BubbleProgress).start()
/home/ksuszyns/git/knative-client-pkg/pkg/output/tui/progress.go:239 +0x44c
knative.dev/client-pkg/pkg/output/tui.(*BubbleProgress).With()
/home/ksuszyns/git/knative-client-pkg/pkg/output/tui/progress.go:85 +0x44
knative.dev/client-pkg/pkg/output/tui_test.TestProgress()
/home/ksuszyns/git/knative-client-pkg/pkg/output/tui/progress_test.go:49 +0x562
testing.tRunner()
/home/ksuszyns/.gvm/gos/go1.21.4/src/testing/testing.go:1595 +0x238
testing.(*T).Run.func1()
/home/ksuszyns/.gvm/gos/go1.21.4/src/testing/testing.go:1648 +0x44
==================
==================
WARNING: DATA RACE
Write at 0x00c00018d6f8 by goroutine 8:
knative.dev/client-pkg/pkg/output/tui.bubbleProgressHandler.progressFrame()
/home/ksuszyns/git/knative-client-pkg/pkg/output/tui/progress.go:192 +0x209
knative.dev/client-pkg/pkg/output/tui.(*BubbleProgress).Update()
/home/ksuszyns/git/knative-client-pkg/pkg/output/tui/progress.go:139 +0x39d
github.com/charmbracelet/bubbletea.(*Program).eventLoop()
/home/ksuszyns/git/knative-client-pkg/vendor/github.com/charmbracelet/bubbletea/tea.go:411 +0xa1b
github.com/charmbracelet/bubbletea.(*Program).Run()
/home/ksuszyns/git/knative-client-pkg/vendor/github.com/charmbracelet/bubbletea/tea.go:543 +0xf77
knative.dev/client-pkg/pkg/output/tui.(*BubbleProgress).start.func1()
/home/ksuszyns/git/knative-client-pkg/pkg/output/tui/progress.go:241 +0x64
Previous read at 0x00c00018d6f8 by goroutine 23:
github.com/charmbracelet/bubbles/progress.(*Model).SetPercent.(*Model).nextFrame.func1()
/home/ksuszyns/git/knative-client-pkg/vendor/github.com/charmbracelet/bubbles/progress/progress.go:285 +0x36
github.com/charmbracelet/bubbles/progress.(*Model).SetPercent.(*Model).nextFrame.Tick.func2()
/home/ksuszyns/git/knative-client-pkg/vendor/github.com/charmbracelet/bubbletea/commands.go:142 +0x83
github.com/charmbracelet/bubbletea.(*Program).handleCommands.func1.1()
/home/ksuszyns/git/knative-client-pkg/vendor/github.com/charmbracelet/bubbletea/tea.go:294 +0x42
Goroutine 8 (running) created at:
knative.dev/client-pkg/pkg/output/tui.(*BubbleProgress).start()
/home/ksuszyns/git/knative-client-pkg/pkg/output/tui/progress.go:239 +0x44c
knative.dev/client-pkg/pkg/output/tui.(*BubbleProgress).With()
/home/ksuszyns/git/knative-client-pkg/pkg/output/tui/progress.go:85 +0x44
knative.dev/client-pkg/pkg/output/tui_test.TestProgress()
/home/ksuszyns/git/knative-client-pkg/pkg/output/tui/progress_test.go:49 +0x562
testing.tRunner()
/home/ksuszyns/.gvm/gos/go1.21.4/src/testing/testing.go:1595 +0x238
testing.(*T).Run.func1()
/home/ksuszyns/.gvm/gos/go1.21.4/src/testing/testing.go:1648 +0x44
Goroutine 23 (running) created at:
github.com/charmbracelet/bubbletea.(*Program).handleCommands.func1()
/home/ksuszyns/git/knative-client-pkg/vendor/github.com/charmbracelet/bubbletea/tea.go:293 +0x236
==================
testing.go:1465: race detected during execution of test
--- FAIL: TestProgress (0.07s)
testing.go:1465: race detected during execution of test
FAIL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment