From e664bdcfb287e7456f084e0335b7c68bab89d6e7 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 6 Sep 2021 16:51:27 +0200 Subject: Improve error handling of cycling delayed queues When an item has been delayed and the queue is cycled to start it, we did not properly report an error from the cycling, and we would then fail in the assert(), causing all errors to be lost. Propagate the error instead and make the assert a warning. --- apt-pkg/acquire.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index c3682504f..100ccde32 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -34,7 +34,6 @@ #include #include -#include #include #include #include @@ -737,9 +736,13 @@ pkgAcquire::RunResult pkgAcquire::Run(int PulseInterval) if (f <= now) { - I->Cycle(); // Queue got stuck, unstuck it. + if (not I->Cycle()) // Queue got stuck, unstuck it. + goto stop; fetchAfter = now; // need to time out in select() below - assert(I->Items->Owner->Status != pkgAcquire::Item::StatIdle); + if (I->Items->Owner->Status == pkgAcquire::Item::StatIdle) + { + _error->Warning("Tried to start delayed item %s, but failed", I->Items->Description.c_str()); + } } else if (f < fetchAfter || fetchAfter == time_point{}) { @@ -781,8 +784,8 @@ pkgAcquire::RunResult pkgAcquire::Run(int PulseInterval) break; } } - } - + } +stop: if (Log != 0) Log->Stop(); -- cgit v1.2.3-70-g09d2