You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#[derive(Clone,Debug)]pubstructIntervalTimer{pubperiod:Duration,pubdelta:Instant,}implIntervalTimer{pubfnnew(period:Duration) -> Self{let delta = Instant::now();Self{ period, delta }}/// Returns true if the interval between calls has exceeded the periodpubfnready(&mutself) -> bool{ifself.delta.elapsed() < self.period{false}else{self.delta = self.delta + self.period;true}}}fnmain(){let duration = Duration::from_secs(3600);letmut timers:Vec<IntervalTimer> = (0..100).map(|_| IntervalTimer::new(Duration::from_millis(10))).collect();let start = Instant::now();while start.elapsed() < duration {
timers.par_iter_mut().for_each(|timer| {let _i = timer.ready();});}}
This seems to consistently panic with the error "supplied instant is later than self” when the ready method is called from with rayon. This is presumably the > comparison calling the Instant::duration_since() method https://doc.rust-lang.org/src/std/time.rs.html#281.
I'm not sure what the root cause is but the stack overflow post has some possibilities.
I found this issue with a similar problem but it relates to using an unusual kernel. I'm just using Ubuntu 18.04 with nothing unusual set up.
I've tried multiple machines but the same error occurs with the code.
Meta
rustc --version --verbose
Sorry, I found this a while ago so don't know the exact version but it was around 1.39.0
Backtrace
thread 'thread '<unnamed><unnamed>' panicked at '' panicked at 'supplied instant is later than self', src/libstd/time.rs:263:9
stack backtrace:
supplied instant is later than self', src/libstd/time.rs:263:9
0: 0x5574c8e3b9e4 - backtrace::backtrace::libunwind::trace::hc1c4a1d8ad423b97
at /cargo/registry/src/git.luolix.top-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
1: 0x5574c8e3b9e4 - backtrace::backtrace::trace_unsynchronized::h82274781060cb056
at /cargo/registry/src/git.luolix.top-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
2: 0x5574c8e3b9e4 - std::sys_common::backtrace::_print_fmt::h2a45d89b653a4da8
at src/libstd/sys_common/backtrace.rs:78
3: 0x5574c8e3b9e4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h41a0a93ab85e6aa1
at src/libstd/sys_common/backtrace.rs:59
4: 0x5574c8e64b2c - core::fmt::write::hdaea18585065a96d
at src/libcore/fmt/mod.rs:1069
5: 0x5574c8e34743 - std::io::Write::write_fmt::h0cea70c809005252
at src/libstd/io/mod.rs:1504
6: 0x5574c8e3e7a5 - std::sys_common::backtrace::_print::hd95f9978cc145ca4
at src/libstd/sys_common/backtrace.rs:62
7: 0x5574c8e3e7a5 - std::sys_common::backtrace::print::hfb25ca2291be47d0
at src/libstd/sys_common/backtrace.rs:49
8: 0x5574c8e3e7a5 - std::panicking::default_hook::{{closure}}::h44f76cee5dc8591c
at src/libstd/panicking.rs:198
9: 0x5574c8e3e4e2 - std::panicking::default_hook::h198e1a712910f1e6
at src/libstd/panicking.rs:218
10: 0x5574c8e3ee02 - std::panicking::rust_panic_with_hook::hc0b4730bb8013f9d
at src/libstd/panicking.rs:511
11: 0x5574c8e3e9eb - rust_begin_unwind
at src/libstd/panicking.rs:419
12: 0x5574c8e62921 - core::panicking::panic_fmt::h1ac71ad045d55416
at src/libcore/panicking.rs:111
13: 0x5574c8e626b3 - core::option::expect_failed::h7baa1c60813ff0e3
at src/libcore/option.rs:1260
14: 0x5574c8e3b3e5 - core::option::Option<T>::expect::h306e330bd810d3ba
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libcore/option.rs:347
15: 0x5574c8e3b3e5 - std::time::Instant::duration_since::hba1f841dfadd1cd2
at src/libstd/time.rs:263
16: 0x5574c8e3b3e5 - <std::time::Instant as core::ops::arith::Sub>::sub::h73cd3ea7a55658e1
at src/libstd/time.rs:390
17: 0x5574c8e3b3e5 - std::time::Instant::elapsed::h67e85e1d84cb14d0
at src/libstd/time.rs:327
18: 0x5574c8bfe09f - locus_sim_engine::utils::interval_timer::IntervalTimer::ready::h7569661c5fd39089
at src/utils/interval_timer.rs:17
19: 0x5574c8bfe09f - locus_sim_engine::system::laser_scan::single_laser_scan::h671b01a54874470e
at src/system/laser_scan.rs:63
20: 0x5574c8bf074d - locus_sim_engine::system::laser_scan::laser_scan::{{closure}}::h1deba93ec7418c4d
at src/system/laser_scan.rs:50
21: 0x5574c8bf074d - core::ops::function::impls::<impl core::ops::function::Fn<A> for &F>::call::h96b179e6c0dd1ac0
at /home/michael/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/function.rs:242
22: 0x5574c8bf074d - core::ops::function::impls::<impl core::ops::function::FnMut<A> for &F>::call_mut::h4f8d7ff151c5feb5
at /home/michael/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/function.rs:252
23: 0x5574c8a918f8 - <locus_sim_api::motor_server::MotorServer<T> as tower_service::Service<http::request::Request<B>>>::call::{{closure}}::hf5b46adb51805ebe
at /home/michael/locus_dev/src/locus_sim_engine/target/release/build/locus-sim-api-4d28cb656733f563/out/locus_sim_api.rs:531
24: 0x5574c8a918f8 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h9798dbde38a1f607
at /home/michael/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/future/mod.rs:66
25: 0x5574c8a104ad - <core::pin::Pin<P> as core::future::future::Future>::poll::h6aa9c7207adebc07
at /home/michael/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/future/future.rs:118
26: 0x5574c8a104ad - <F as futures_core::future::TryFuture>::try_poll::h5633e6d6a71350d5
at /home/michael/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/futures-core-0.3.5/src/future.rs:83
27: 0x5574c8a104ad - <futures_util::future::try_future::into_future::IntoFuture<Fut> as core::future::future::Future>::poll::h20812bb48a44deb6
at /home/michael/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/futures-util-0.3.5/src/future/try_future/into_future.rs:31
28: 0x5574c8a104ad - <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll::h7de76b6b06dabc84
at /home/michael/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/futures-util-0.3.5/src/future/future/map.rs:67
29: 0x5574c8a10298 - <futures_util::future::future::Map<Fut,F> as core::future::future::Future>::poll::h87636451ef52bf16
at /home/michael/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/futures-util-0.3.5/src/lib.rs:107
30: 0x5574c8a10298 - <futures_util::future::try_future::MapErr<Fut,F> as core::future::future::Future>::poll::hf361a24bd15b64de
at /home/michael/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/futures-util-0.3.5/src/lib.rs:107
31: 0x5574c8a10298 - <futures_util::future::either::Either<A,B> as core::future::future::Future>::poll::h3ba6a79df0fece24
at /home/michael/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/futures-util-0.3.5/src/future/either.rs:65
32: 0x5574c8a10298 - <F as futures_core::future::TryFuture>::try_poll::h5d9826bce7bec57c
at /home/michael/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/futures-core-0.3.5/src/future.rs:83
33: 0x5574c8a10298 - <futures_util::future::try_future::into_future::IntoFuture<Fut> as core::future::future::Future>::poll::h8cc4e2435674ca81
at /home/michael/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/futures-util-0.3.5/src/future/try_future/into_future.rs:31
34: 0x5574c8a10298 - <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll::h3a97595fa35bf6b4
at /home/michael/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/futures-util-0.3.5/src/future/future/map.rs:67
35: 0x5574c8a10645 - <futures_util::future::future::Map<Fut,F> as core::future::future::Future>::poll::h1f03e91c826fb89f
at /home/michael/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/futures-util-0.3.5/src/lib.rs:107
36: 0x5574c8a10645 - <futures_util::future::try_future::MapErr<Fut,F> as core::future::future::Future>::poll::hbb30c6370d1ad4dd
at /home/michael/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/futures-util-0.3.5/src/lib.rs:107
37: 0x5574c8a10645 - <futures_util::future::either::Either<A,B> as core::future::future::Future>::poll::h45a493d70ab6cb16
at /home/michael/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/futures-util-0.3.5/src/future/either.rs:66
38: 0x5574c8a10645 - <F as futures_core::future::TryFuture>::try_poll::h3218040a42683b8c
at /home/michael/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/futures-core-0.3.5/src/future.rs:83
39: 0x5574c8a10645 - <futures_util::future::try_future::into_future::IntoFuture<Fut> as core::future::future::Future>::poll::hffacf042cca96add
at /home/michael/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/futures-util-0.3.5/src/future/try_future/into_future.rs:31
40: 0x5574c8a10645 - <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll::hd3999158d5641280
at /home/michael/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/futures-util-0.3.5/src/future/future/map.rs:67
41: 0x5574c8a0fca0 - <futures_util::future::future::Map<Fut,F> as core::future::future::Future>::poll::he914f5b3eab7d7ff
at /home/michael/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/futures-util-0.3.5/src/lib.rs:107
42: 0x5574c8a0fca0 - <futures_util::future::try_future::MapErr<Fut,F> as core::future::future::Future>::poll::haa236b3c8a953e0b
at /home/michael/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/futures-util-0.3.5/src/lib.rs:107
43: 0x5574c8a0fca0 - <futures_util::future::either::Either<A,B> as core::future::future::Future>::poll::h79e46a6c42aa3fc0
at /home/michael/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/futures-util-0.3.5/src/future/either.rs:66
44: 0x5574c8a0fca0 - <F as futures_core::future::TryFuture>::try_poll::h11442ab0450f9aba
at /home/michael/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/futures-core-0.3.5/src/future.rs:83
45: 0x5574c8a0fca0 - <futures_util::future::try_future::into_future::IntoFuture<Fut> as core::future::future::Future>::poll::h4514bbaa544f1a54
at /home/michael/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/futures-util-0.3.5/src/future/try_future/into_future.rs:31
46: 0x5574c8a0fca0 - <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll::h3467a48e5d1b449e
at /home/michael/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/futures-util-0.3.5/src/future/future/map.rs:67
47: 0x5574c8a0f5e5 - <futures_util::future::future::Map<Fut,F> as core::future::future::Future>::poll::hc132b12a66e846ba
at /home/michael/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/futures-util-0.3.5/src/lib.rs:107
48: 0x5574c8a0f5e5 - <futures_util::future::try_future::MapErr<Fut,F> as core::future::future::Future>::poll::hbbbc3932986b69ae
at /home/michael/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/futures-util-0.3.5/src/lib.rs:107
The text was updated successfully, but these errors were encountered:
On linux the correctness of CLOCK_MONOTONIC depends on the kernel, firmware updates and the CPU to do the right thing. And decisions can be overriden with manual clock source configuration. Running in docker won't replace your kernel or load older firmware images, so it doesn't help with testing.
I updated the example to include a main function that would match roughly the real surrounding code. I suspect the rayon component doesn't do much other than multiply the probability. When I was encountering this issue it was only after multiple hours of runtime but it was happening consistently. I'll see if I can get it to happen again (I have since added a workaround based on the answers in the stackoverflow post) and if I can i'll see if its reproducible on 20.04.
I ran the test code for multiple hours and I wasn't able to reproduce the original behaviour. I think this can be closed as not reproducible and assumed to be something a kernel update etc fixed.
This is from a question I posted on stack overflow a few months ago so there is more discussion there about how I came across it.
https://stackoverflow.com/questions/64159779/rust-stdtimeinstant-panicked-at-supplied-instant-is-later-than-self
I tried this code:
This seems to consistently panic with the error "supplied instant is later than self” when the
ready
method is called from withrayon
. This is presumably the>
comparison calling theInstant::duration_since()
method https://doc.rust-lang.org/src/std/time.rs.html#281.I'm not sure what the root cause is but the stack overflow post has some possibilities.
I found this issue with a similar problem but it relates to using an unusual kernel. I'm just using Ubuntu 18.04 with nothing unusual set up.
I've tried multiple machines but the same error occurs with the code.
Meta
rustc --version --verbose
Sorry, I found this a while ago so don't know the exact version but it was around 1.39.0
Backtrace
The text was updated successfully, but these errors were encountered: