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

c8y events downloadBinary panics when being piped to #303

Closed
reubenmiller opened this issue Sep 6, 2023 · 1 comment
Closed

c8y events downloadBinary panics when being piped to #303

reubenmiller opened this issue Sep 6, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@reubenmiller
Copy link
Owner

There is a bug with the progress bar code when downloading multiple event binaries via the pipeline. The progress bar seems to be reused after it has been released.

c8y events list --type c8y-configuration-plugin | c8y events downloadBinary
elapsed 00:00   3425295  [━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━] 100 % 487.00 b / 487.00 b
# Add the configurations to be managed by c8y-configuration-plugin
files = [
#    { path = '/etc/tedge/tedge.toml' },
#    { path = '/etc/tedge/mosquitto-conf/c8y-bridge.conf', type = 'c8y-bridge.conf' },
#    { path = '/etc/tedge/mosquitto-conf/tedge-mosquitto.conf', type = 'tedge-mosquitto.conf' },
#    { path = '/etc/mosquitto/mosquitto.conf', type = 'mosquitto.conf' },
#    { path = '/etc/tedge/c8y/example.txt', type = 'example', user = 'tedge', group = 'tedge', mode = 0o444 }
]
panic: *mpb.Progress instance can't be reused after it's done!

goroutine 99 [running]:
github.com/vbauerster/mpb/v6.(*Progress).Add(0x1400019c9c0, 0x1e7, {0x10583fe68, 0x1400019cc60}, {0x14000383ba0, 0x2, 0x2})
	github.com/vbauerster/mpb/v6@v6.0.4/progress.go:143 +0x204
github.com/reubenmiller/go-c8y-cli/v2/pkg/c8ybinary.CreateProxyReader.func1(0x140003685a0)
	github.com/reubenmiller/go-c8y-cli/v2/pkg/c8ybinary/c8ybinary.go:103 +0x5e0
github.com/reubenmiller/go-c8y-cli/v2/pkg/request.(*RequestHandler).ProcessRequestAndResponse.func1(0x140003685a0)
	github.com/reubenmiller/go-c8y-cli/v2/pkg/request/request.go:102 +0x88
github.com/reubenmiller/go-c8y/pkg/c8y.(*Client).Do(0x140007623c0, {0x105845320, 0x1400019ffb0}, 0x140003f4800, {0x105737840?, 0x1400070e150}, {0x0, 0x0, 0x0?})
	github.com/reubenmiller/go-c8y@v0.14.9/pkg/c8y/client.go:1125 +0xb10
github.com/reubenmiller/go-c8y/pkg/c8y.(*Client).SendRequest(0x140007623c0, {0x105845320, 0x1400019ffb0}, {{0x1054db85c, 0x3}, {0x0, 0x0}, {0x140000dea80, 0x1d}, {0x0, ...}, ...})
	github.com/reubenmiller/go-c8y@v0.14.9/pkg/c8y/client.go:682 +0xafc
github.com/reubenmiller/go-c8y-cli/v2/pkg/request.(*RequestHandler).ProcessRequestAndResponse(0x1400071e0f0, {0x1400093aa00?, 0xa0?, 0x105705de0?}, {0x1056f2a80, 0x14000834690}, {{0x1054e5b24, 0x10}, {0x0, 0x0}, ...})
	github.com/reubenmiller/go-c8y-cli/v2/pkg/request/request.go:114 +0x440
github.com/reubenmiller/go-c8y-cli/v2/pkg/worker.(*Worker).batchWorker(0x140007a6300, 0x1?, 0x140000d88a0?, 0x140000d8900?, 0x14000148300?, 0x14000386df0?)
	github.com/reubenmiller/go-c8y-cli/v2/pkg/worker/worker.go:434 +0x458
created by github.com/reubenmiller/go-c8y-cli/v2/pkg/worker.(*Worker).runBatched
	github.com/reubenmiller/go-c8y-cli/v2/pkg/worker/worker.go:201 +0xcc

Workaround

If you disable the progress bar (via --noProgress on the downloadBinary command) it avoids the panic and works as expected.

c8y events list --type c8y-configuration-plugin | c8y events downloadBinary --noProgress
@reubenmiller reubenmiller added the bug Something isn't working label Sep 6, 2023
@reubenmiller
Copy link
Owner Author

I can't reproduce this anymore. The above command works fine in >= 2.40.

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

1 participant