diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2021-09-06 16:51:27 +0200 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2021-09-06 16:51:27 +0200 |
commit | e664bdcfb287e7456f084e0335b7c68bab89d6e7 (patch) | |
tree | 47cb8e81e186e3211798e113ad28141efd834e5d | |
parent | 25162dd82b5425bb123415e0fcc50377175055f5 (diff) |
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.
-rw-r--r-- | apt-pkg/acquire.cc | 13 |
1 files changed, 8 insertions, 5 deletions
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 <tuple> #include <vector> -#include <assert.h> #include <dirent.h> #include <errno.h> #include <fcntl.h> @@ -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(); |