Open chroche opened 1 month ago
What dependencies are you using?
Hi,
attached the full Cargo tree.
Sorry I don't think there's enough information here for us to do anything.
What else do you think could help? Would having the core dump do?
Sorry, I have no idea what to look for in a core dump.
This panic may hit #6612
For what it's worth, this is what I'm able to extract from the core file:
> lldb -f bin.76013 -c /cores/core.76013
(lldb) f 12
frame #12: 0x0000000106402f7c bin.76013`tokio::util::linked_list::LinkedList$LT$L$C$$LT$L$u20$as$u20$tokio..util..linked_list..Link$GT$..Target$GT$::push_front::h6e00c199c3bb503f(self=0x00007f8c19813410, val=TimerHandle @ 0x00007ff7bb0e94c0) at linked_list.rs:130:9
127 // The value should not be dropped, it is being inserted into the list
128 let val = ManuallyDrop::new(val);
129 let ptr = L::as_raw(&val);
-> 130 assert_ne!(self.head, Some(ptr));
131 unsafe {
132 L::pointers(ptr).as_mut().set_next(self.head);
133 L::pointers(ptr).as_mut().set_prev(None);
(lldb) f 13
frame #13: 0x000000010640e84d bin.76013`tokio::runtime::time::wheel::level::Level::add_entry::h4a24c2925dc882a2(self=0x00007f8c19813220, item=TimerHandle @ 0x00007ff7bb0e9558) at level.rs:207:9
204 pub(crate) unsafe fn add_entry(&mut self, item: TimerHandle) {
205 let slot = slot_for(item.cached_when(), self.level);
206
-> 207 self.slot[slot].push_front(item);
208
209 self.occupied |= occupied_bit(slot);
210 }
(lldb) f 14
frame #14: 0x000000010640ecde bin.76013`tokio::runtime::time::wheel::Wheel::insert::h016cc9f1112e2ab3(self=0x00007f8c19707c30, item=TimerHandle @ 0x00007ff7bb0e95b0) at mod.rs:105:13
102 let level = self.level_for(when);
103
104 unsafe {
-> 105 self.levels[level].add_entry(item);
106 }
107
108 debug_assert!({
(lldb) f 15
frame #15: 0x0000000106410109 bin.76013`tokio::runtime::time::_$LT$impl$u20$tokio..runtime..time..handle..Handle$GT$::reregister::h2393815bbe43b29e(self=0x00007f8c19707c28, unpark=0x00007f8c19707bb0, new_tick=130047, entry=NonNull<tokio::runtime::time::entry::TimerShared> @ 0x00007ff7bb0e9698) at mod.rs:361:32
358 // Note: We don't have to worry about racing with some other resetting
359 // thread, because add_entry and reregister require exclusive control of
360 // the timer entry.
-> 361 match unsafe { lock.wheel.insert(entry) } {
362 Ok(when) => {
363 if lock
364 .next_wake
(lldb) f 16
frame #16: 0x000000010640c9ee bin.76013`tokio::runtime::time::entry::TimerEntry::reset::h2f570947accf58f9(self=Pin<&mut tokio::runtime::time::entry::TimerEntry> @ 0x00007ff7bb0e97a0, new_time=Instant @ 0x00007ff7bb0e97b0, reregister=true) at entry.rs:546:17
543
544 if reregister {
545 unsafe {
-> 546 self.driver()
547 .reregister(&self.driver.driver().io, tick, self.inner().into());
548 }
549 }
(lldb) f 17
frame #17: 0x000000010640ca91 bin.76013`tokio::runtime::time::entry::TimerEntry::poll_elapsed::had2ed4c224869068(self=Pin<&mut tokio::runtime::time::entry::TimerEntry> @ 0x00007ff7bb0e9848, cx=0x00007ff7bb1274b0) at entry.rs:564:13
561
562 if !self.registered {
563 let deadline = self.deadline;
-> 564 self.as_mut().reset(deadline, true);
565 }
566
567 let this = unsafe { self.get_unchecked_mut() };
(lldb) f 18
frame #18: 0x000000010644b6cb bin.76013`tokio::time::sleep::Sleep::poll_elapsed::h40485d45d511410e(self=Pin<&mut tokio::time::sleep::Sleep> @ 0x00007ff7bb0e98c8, cx=0x00007ff7bb1274b0) at sleep.rs:416:22
413 #[cfg(any(not(tokio_unstable), not(feature = "tracing")))]
414 let coop = ready!(crate::runtime::coop::poll_proceed(cx));
415
-> 416 let result = me.entry.poll_elapsed(cx).map(move |r| {
417 coop.made_progress();
418 r
419 });
(lldb) f 19
frame #19: 0x000000010644b7fc bin.76013`_$LT$tokio..time..sleep..Sleep$u20$as$u20$core..future..future..Future$GT$::poll::hd8bf0c190314fba3(self=Pin<&mut tokio::time::sleep::Sleep> @ 0x00007ff7bb0e9930, cx=0x00007ff7bb1274b0) at sleep.rs:448:22
445 let _ao_span = self.inner.ctx.async_op_span.clone().entered();
446 #[cfg(all(tokio_unstable, feature = "tracing"))]
447 let _ao_poll_span = self.inner.ctx.async_op_poll_span.clone().entered();
-> 448 match ready!(self.as_mut().poll_elapsed(cx)) {
449 Ok(()) => Poll::Ready(()),
450 Err(e) => panic!("timer error: {}", e),
451 }
(lldb) f 20
frame #20: 0x0000000104f1cadf bin.76013`asg_updater::asg::asg_update::_$u7b$$u7b$closure$u7d$$u7d$::h0e4e0fa7473f8458((null)=0x00007ff7bb1274b0) at asg.rs:113:50
110
111 if asg_name == TIMEOUT_STRING {
112 trace!("Sleeping for {}s", REFRESH_INTERVAL);
-> 113 sleep(Duration::from_secs(REFRESH_INTERVAL)).await;
114 return Ok(());
115 }
BTW what I'm naively trying to do here is implement my own timeout into a MappedFutures::next()
call (this crate), but it's likely not the best / correct way to do it (I'm new to this). Any advice greatly appreciated! :-)
That crate has a lot of unsafe code, a lot of yanked versions, and no public repository, so I'm not feeling so confident about it. Incorrect unsafe code in a third-party crate can easily lead to the error you are seeing, so based on that, that would be my first theory.
Yes I had a feeling too that this may be the root cause. I'm going to see if I can avoid using it.
Thanks!
Version
Platform
Description I seem to be able to reproduce the bug mentioned in https://github.com/tokio-rs/tokio/issues/5782.
Error message:
The stacktrace looks like this:
I can provide privately if helpful the binary that produced the crash, the associated core dump and the session logs. Works on my MacOS Monterey 12.7.5 with