Closed cipriancraciun closed 4 years ago
Based on some further experimentation it seems that although after Wait
returns there are no more goroutines running (except the main one), in some cases the bar still is not removed, which points away from a potential race condition in the code, and towards a "logic" issue.
I have also made sure to os.Stderr.Sync ()
(which I've used for WithOutput
), so the issue is not buffering.
I've also made sure to panic if Completed
is false (before calling Wait
), and also checked that BarCount
is zero (after returning Wait
). In all cases when the bar remained visible no panic exception occurred, which further leads towards mainly a display bug.
Thanks for reporting! Can you please check on latest master? I just pushed commits, which should fix this.
Yes, I can confirm that by using the latest commit the issue seems to be solved: https://github.com/vbauerster/mpb/commit/dc22c1ba454298ef392acdc1e720a905ab809974
Thanks! I'll close this issue. (If it resurfaces, I'll reopen it again.)
Although I've used
BarRemoveOnComplete
onAddBar
, I am making sureSetTotal
andSetCurrent
are correctly set to be completed, and I'm waiting forWait
to complete, sometimes the bar fails to be removed after completion.Through experimentation, I've observed that waiting after
Wait
the same amount of time (plus some extra) as I've set withmpb.WithRefreshRate
, seems to solve the issue.This makes me think there is perhaps a race condition happening inside
Wait
?