Remove an unnecessary QUIC_BUG that causes unit tests to flake. Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1351746 PiperOrigin-RevId: 480592828
diff --git a/quiche/quic/core/io/quic_all_event_loops_test.cc b/quiche/quic/core/io/quic_all_event_loops_test.cc index 16eb344..ed62824 100644 --- a/quiche/quic/core/io/quic_all_event_loops_test.cc +++ b/quiche/quic/core/io/quic_all_event_loops_test.cc
@@ -419,5 +419,22 @@ loop_->RunEventLoopOnce(QuicTime::Delta::FromMilliseconds(-1)); } +TEST_P(QuicEventLoopFactoryTest, ScheduleAlarmInPastFromInsideAlarm) { + constexpr auto kAlarmTimeout = QuicTime::Delta::FromMilliseconds(20); + auto [alarm1_ptr, delegate1] = CreateAlarm(); + auto [alarm2_ptr, delegate2] = CreateAlarm(); + + alarm1_ptr->Set(clock_.Now() - kAlarmTimeout); + EXPECT_CALL(*delegate1, OnAlarm()) + .WillOnce([&, alarm2_unowned = alarm2_ptr.get()]() { + alarm2_unowned->Set(clock_.Now() - 2 * kAlarmTimeout); + }); + bool fired = false; + EXPECT_CALL(*delegate2, OnAlarm()).WillOnce([&]() { fired = true; }); + + RunEventLoopUntil([&]() { return fired; }, + QuicTime::Delta::FromMilliseconds(100)); +} + } // namespace } // namespace quic::test
diff --git a/quiche/quic/core/io/quic_poll_event_loop.cc b/quiche/quic/core/io/quic_poll_event_loop.cc index 1c90be5..f56635f 100644 --- a/quiche/quic/core/io/quic_poll_event_loop.cc +++ b/quiche/quic/core/io/quic_poll_event_loop.cc
@@ -99,12 +99,9 @@ } QuicTime end_time = std::min(now + default_timeout, alarms_.begin()->first); if (end_time < now) { - // Since we call ProcessAlarmsUpTo() right before this, this should never - // happen. - QUIC_BUG(Newest alarm is in the past) - << "now " << now.ToDebuggingValue() - << ", end_time: " << end_time.ToDebuggingValue() - << ", default timeout: " << default_timeout; + // We only run a single pass of processing alarm callbacks per + // RunEventLoopOnce() call. If an alarm schedules another alarm in the past + // while in the callback, this will happen. return QuicTime::Delta::Zero(); } return end_time - now;