vbauerster / mpb

multi progress bar for Go cli applications
The Unlicense
2.29k stars 123 forks source link

Bars get stuck after the process is complete #75

Closed Skarlso closed 3 years ago

Skarlso commented 4 years ago

Hi!

I have an interesting issue. I'm not sure how or why or what, but a bar can get stuck on the screen after the process has completed and will stay there.

It ends up with bars, like these:

test25/imdb_edges: 5% [=>-------------------------------------------] ETA: 1m35s
test25/imdb_vertices: 19% [=======>-----------------------------------] ETA: 21s
test25/imdb_edges: 51% [======================>----------------------] ETA: 4m6s
test99/imdb_edges: 49% [=====================>----------------------] ETA: 4m22s
test15/imdb_edges: 45% [===================>-------------------------] ETA: 5m3s
test21/imdb_edges: 45% [===================>-------------------------] ETA: 5m0s
test41/imdb_edges: 55% [=======================>--------------------] ETA: 3m27s
test20/imdb_edges: 44% [==================>-------------------------] ETA: 5m21s
test16/imdb_edges: 44% [==================>-------------------------] ETA: 5m20s
test10/imdb_edges: 45% [===================>------------------------] ETA: 4m57s
test57/imdb_edges: 53% [======================>---------------------] ETA: 3m41s
test56/imdb_edges: 55% [=======================>--------------------] ETA: 3m24s

Where test25/imdb_edges: actually completed. Background:

The jump count is rather high. It isn't going by ones, it's incrementing by 1000s whilst the end count is not necessarily dividable by 1000. Which means that it will either overflow or underflow and the next will overflow.

By this time, I think the refresh frequency and the bar's completion is not aligned. Meaning it completes, but the refresh isn't ticking and isn't removing it. I'm removing the bars upon completion. And I'm using multiple go routines and multiple bars.

Also, it looks like this is swallowing errors and other displays on stdout. Which is probably fine, I'm just curious if there is a way to avoid that. Because in the background there could be an error happening, but I will never see that because the cursor reset probably.

Any ideas what I could do in this matter? Cheers!

Skarlso commented 4 years ago

Actually, here is the code: https://github.com/arangodb-managed/arangocopy/blob/master/pkg/collections.go#L170

It's public so you should be able to see it. :)

vbauerster commented 4 years ago

Hi! Can you please add Counters decorator, and report back what it shows at moment of getting stuck? I didn't have a chance to check your code thoroughly and probably won't. However I did a quick look. Not sure what was your intention here but most probably you're using bar.Completed method in the wrong place.