Don't panic in duration underflow#12693
Don't panic in duration underflow#12693ConradIrwin wants to merge 1 commit intobytecodealliance:mainfrom
Conversation
In debug mode we check for tokens being dropped out of order, but in a release build this can fail.
|
Thanks for your report and this PR! I don't think any of the current contributors have touched this code in a while so we may not have a full understanding of its invariants, but I'm surprised that "tokens are dropped out of order" -- do you have a reproduction of that? (I see your companion issue filed said you had no repro, but maybe you do with this PR?) In any case, I'm happy to merge it as a conservative fix but I'd like to understand if there's an underlying invariant violation that it would mask first, too. |
|
(As an aside, I'm also surprised you're seeing this in (presumably production) telemetry -- is the timing infra enabled in your configuration?) |
|
@cfallin no reproduction, just a somewhat surprising crash showed up in our telemetry. I think timings are logged if Claude's (very hand-wavy) explanation for the out of order timing was that as these things happen on different threads, the drop ordering was not guaranteed; but not sure I believe it. (It seems like some care is taken to avoid this, hence the debug assert here: https://github.com/ConradIrwin/wasmtime/blob/c5214df981a88d30226e9b3ac1b88da32395806a/cranelift/codegen/src/timing.rs#L269). The other potential options are something weird with instants (e.g. this purported issue zed-industries/zed#46636); or given this has only happened once, a particularly targeted cosmic ray. |
OK, that's fortunately not possible -- Claude must not have seen the I'll take a closer look at this code and try to understand its invariants next week -- in the meantime, any further info you can gather about repros or conditions this is seen under are of course appreciated. Thanks! |
In debug mode we check for tokens being dropped out of order, but in a
release build this can fail.
Closes #12692