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

Fix possible instant subtraction panic racing the clock #182

Merged
merged 1 commit into from
Feb 19, 2019

Conversation

alexheretic
Copy link
Contributor

I got a panic that I found difficult to reproduce reliably. Instant subtractions will panic if the rhs is bigger, and two calls of Instant::now may be different. So its sort of a race with the clock to see if this panics.

thread '<unnamed>' panicked at 'specified instant was later than self', src/libstd/sys/unix/time.rs:292:17
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:70
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:58
             at src/libstd/panicking.rs:200
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:215
   4: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:478
   5: std::panicking::begin_panic
             at src/libstd/panicking.rs:412
   6: std::sys::unix::time::inner::Instant::sub_instant::{{closure}}
             at src/libstd/sys/unix/time.rs:292
   7: <std::time::Instant as core::ops::arith::Sub>::sub
             at /rustc/d1731801163df1d3a8d4ddfa68adac2ec833ef7f/src/libcore/result.rs:764
             at src/libstd/sys/unix/time.rs:291
             at src/libstd/time.rs:218
             at src/libstd/time.rs:307
   8: notify::debounce::timer::ScheduleWorker::run
             at /home/alex/.cargo/registry/src/github.com-1ecc6299db9ec823/notify-4.0.9/src/debounce/timer.rs:99

@passcod
Copy link
Member

passcod commented Feb 19, 2019

Great find!

@passcod passcod merged commit 84cd587 into notify-rs:main Feb 19, 2019
@matklad
Copy link

matklad commented Mar 6, 2019

Would appreciate a bugfix release with this fix :)

@passcod
Copy link
Member

passcod commented Mar 6, 2019

Done in 4.0.10.

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

Successfully merging this pull request may close these issues.

3 participants