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

ticker_drop test fails occasionally - race condition in Ticker? #464

Closed
chris-laplante opened this issue Aug 11, 2022 · 1 comment
Closed

Comments

@chris-laplante
Copy link
Collaborator

The ticker_drop render test occasionally fails.

Reproduce it by running this command:

while cargo test --all-features ticker_drop; do :; done

It will eventually fail with something like this:

running 1 test
test ticker_drop ... FAILED

failures:

---- ticker_drop stdout ----
thread 'ticker_drop' panicked at 'assertion failed: `(left == right)`
  left: `"⠁ doing stuff 0\n  doing stuff 1\n  doing stuff 2\n  doing stuff 3\n  doing stuff 4"`,
 right: `"  doing stuff 0\n  doing stuff 1\n  doing stuff 2\n  doing stuff 3\n  doing stuff 4"`', tests/render.rs:347:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Somehow the spinner is not correctly getting finished. Clearly there is a subtle race condition somewhere but I haven't been able to track it down.

chris-laplante added a commit to chris-laplante/indicatif that referenced this issue Aug 12, 2022
Fixes console-rs#464 and console-rs#451

Possibly fixes console-rs#411 (if not already fixed?)
@chris-laplante
Copy link
Collaborator Author

chris-laplante commented Aug 13, 2022

This turned out to be a problem with MultiProgress, not Ticker.

To simplify the problem, you can change the number of tickers from 5 to 2. Depending on the order in which the tickers interleaved, you could end up with this:

Ticker 0 Ticker 1 MultiProgress
Tick, draw ⠁ doing stuff 0 Draw ⠁ doing stuff 0
Tick, draw ⠁ doing stuff 1 Draw \n⠁ doing stuff 1
Arc drops the BarState, so draw doing stuff 0 Ticker 0 Weak<BarState> is dead, so it's a zombie 🧟. Erase 1 line, draw \n⠁ doing stuff 1

In summary, the Ticker and ProgressBar are working as they should, but the way MultiProgress detects zombies is broken wrt how "finish"ing works.

chris-laplante added a commit to chris-laplante/indicatif that referenced this issue Aug 13, 2022
Fixes console-rs#464 and console-rs#451

Possibly fixes console-rs#411 (if not already fixed?)
chris-laplante added a commit to chris-laplante/indicatif that referenced this issue Aug 17, 2022
Fixes console-rs#464 and console-rs#451

Possibly fixes console-rs#411 (if not already fixed?)
chris-laplante added a commit to chris-laplante/indicatif that referenced this issue Aug 17, 2022
Fixes console-rs#464 and console-rs#451

Possibly fixes console-rs#411 (if not already fixed?)
chris-laplante added a commit to chris-laplante/indicatif that referenced this issue Sep 8, 2022
Fixes console-rs#464 and console-rs#451

Possibly fixes console-rs#411 (if not already fixed?)
chris-laplante added a commit to chris-laplante/indicatif that referenced this issue Sep 8, 2022
Fixes console-rs#464 and console-rs#451

Possibly fixes console-rs#411 (if not already fixed?)
chris-laplante added a commit to chris-laplante/indicatif that referenced this issue Sep 8, 2022
Fixes console-rs#464 and console-rs#451

Possibly fixes console-rs#411 (if not already fixed?)
@djc djc closed this as completed in d32eed5 Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant