-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add debug message in time panic #37137
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
Comments
/cc @ alexcrichton We meet this panic in linux randomly, the backtrace is:
This is strange that monotonic time jumps back. |
This panic doesn't necessarily mean monotonic time jumps backwards (that would definitely be bad!) It could also just be the accidental ordering of two times in a subtraction perhaps? |
yes, it is mainly for subtracting a larger Instant time, not only for monotonic time jumping back. As you can see, we meet panic in |
Oh interesting! If this is happening in Does this happen on one particular platform? And if so, is there a way to reproduce it? (even sporadically) |
If the panics are on a *nix server, this could be caused by NTP shenanigans as we are using |
It's not present on all kernel versions we support, but it seems like one of those things we should detect support for at runtime. |
In any case even if there's not kernel support we should never panic in |
Hi @alexcrichton
|
Hi @japaric
Seem that NTP can't let monotonic clock jump back, but only affects its rate. |
Hm so I don't understand why @siddontang an explicit condition where this function can panic is when an (Instant::now() + Duration::new(100, 0)).elapsed(); Is that happening in your program? Or does your usage of let start = Instant::now();
// ...
let dur = start.elapsed(); |
Our usage is: let start = Instant::now();
let dur = start.elapsed(); We meet this panic rarely, maybe after running our program for many days. |
Unusual! Definitely seems bad :( |
Update: we write a simple two program, the one uses CLOCK_MONOTONIC, the other uses CLOCK_MONOTONIC_RAW, both codes like:
We run these two programs with our program. When our program panics with clock jumping back, we find the program with CLOCK_MONOTONIC also panics too, but the program CLOCK_MONOTONIC_RAW still works. I don't think this the issue for Rust but it is for the ucloud system (/cc @wuzhy) now. Can we close it now? |
Ah thanks for the update @siddontang! Sounds reasonable to me. |
In developing tikv, we met a strange panic here, https://github.com/rust-lang/rust/blob/master/src/libstd/sys/unix/time.rs#L276
But this panic does not have enough debug info, we think we can add the earlier and current time debug message in the panic message.
The text was updated successfully, but these errors were encountered: