Following up, `Acquire::Retries=0` seems to be avoiding the bug in prod,
which strengthens my suspicion that it's related to retries.

As for the actual bug, when apt is hanging, I notice that the work queue
has items in it, but they have not been delegated to a worker. There is
a condition that is supposed to "unstuck" the queue here[1], but for
some reason `GetFetchAfter` is returning a zeroed time_point which
avoids that condition[2].

The way we're setting `FetchAfter` looks OK to me[3] though I'm not
familiar with std::chrono. Maybe there's some other place where we're
partially copying the item or instantiating a new item and failing to
copy the `FetchAfter` value.

A bandaid patch is attached. I'm not sure if there's any downside in
calling `Cycle` there. A real bugfix IMO would address the zeroed
`FetchAfter` value described above, or potentially refactor so that work
items are immediately delegated instead of having to rely on calling
`Cycle` at the right time. I am missing a lot of context so that maybe
that's not possible.

[1] https://salsa.debian.org/apt-
team/apt/-/blob/db797312548f6e7d6d1d1faa9f1e48c1e521d290/apt-
pkg/acquire.cc#L738-740

[2] https://salsa.debian.org/apt-
team/apt/-/blob/db797312548f6e7d6d1d1faa9f1e48c1e521d290/apt-
pkg/acquire.cc#L733-736

[3] https://salsa.debian.org/apt-
team/apt/-/blob/db797312548f6e7d6d1d1faa9f1e48c1e521d290/apt-
pkg/acquire-worker.cc#L651-655


** Attachment added: "patch"
   
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/2003851/+attachment/5759339/+files/patch

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2003851

Title:
  occasional hanging 'apt-get update' from daily cronjob since Jammy
  22.04

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/2003851/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to