Skip to content

Repeat bars appear when using sleep and/or update! in strange patterns #352

@miles-1

Description

@miles-1

I have sometimes seen duplicate bars appear for tasks randomly, such that they look like this:

Progress:  20%|██████▎                                               |  ETA: 0:00:06Progress:
Progress: 100%|██████████████████████████████████████████████████████| Time: 0:00:02

To investigate, I tried all combinations of the lines A, B, and C annotated in the code below:

using ProgressMeter: Progress, update!, next!, finish!

function some_task(p::Progress)
    @Threads.threads for _ in 1:10
        sleep(0.5) # line A
        next!(p)
    end
end

for i in 1:10
    printstyled("Attempt $i\n"; underline=true)
    p = Progress(10)
    update!(p, 0, force=true) # line B
    sleep(1) # line C
    some_task(p)
    finish!(p)
end

I found the following behaviors for the combinations of these lines:

  • None: no bars appear at all (expected - tasks are fast)
  • A: single bars (expected)
  • B: single bars (expected)
  • C: repeat bars (>>>unexpected)
  • A+B: repeat bars (>>>unexpected)
  • A+C single bars (expected)
  • B+C: repeat bars (>>>unexpected)
  • A+B+C: repeat bars (>>>unexpected)

I see no discernable pattern in this behavior. I believe this repeat-bar behavior should not occur under any of the circumstances listed above.

I'm on ProgressMeter v1.10.4. Here is my versioninfo():

Julia Version 1.11.6
Commit 9615af0f269 (2025-07-09 12:58 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (x86_64-apple-darwin24.0.0)
  CPU: 8 × Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, skylake)
Threads: 8 default, 0 interactive, 4 GC (on 8 virtual cores)
Environment:
  JULIA_EDITOR = code
  JULIA_VSCODE_REPL = 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions