Closed Bug 1879650 Opened 1 year ago Closed 9 months ago

Background Update Task gets stuck in a loop of connecting to the download and then not completing it

Categories

(Toolkit :: Application Update, defect, P3)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1875502

People

(Reporter: bytesized, Unassigned)

References

Details

(Whiteboard: [fidedi-ope])

Attachments

(1 file)

While investigating a different issue (Bug 1856462), I tried manually running background update locally to get some reference logs to compare against those provided by the user. But, to my surprise, my Background Update Task seemed to get stuck in a loop rather than installing the update. To keep things consistent and prevent race conditions, the Background Update Task will not both download and stage the update in the same run, even if the download completes effectively instantly. This is gated by this variable. In theory, this makes it so that if we enter the update cycle at the "checking for update" phase, we won't proceed past the "download" phase.

However, here is what I think is happening instead. _postUpdateProcessing finds the in-progress download and calls downloadUpdate, which will transition the update state to STATE_DOWNLOADING. However, it does this state change at the end of the function, and the function is asynchronous. I believe that this leaves an open opportunity (which seems to be hit pretty consistently, from what I'm seeing) for the Background Update Task to create an AppUpdater instance and inspect its status before the state transition happens, causing it to report STATUS.CHECKING. This sets UpdateService.onlyDownloadUpdatesThisSession = true and leads to the Background Update Task getting stuck in a loop.

Whiteboard: [fidedi-ope]

Setting P3/S3 but I'm assuming :bytesized might want to adjust. It doesn't sound like this is e.g. something that eats system resources or hard blocks updates for extended periods of time?

Severity: -- → S3
Priority: -- → P3
Summary: Background Update Task gets stuck in a loop of connecting to the downoad and then not completing it → Background Update Task gets stuck in a loop of connecting to the download and then not completing it

I believe that this was fixed by Bug 1875502. As described in comment 0, the race condition was possible because we would try to examine the update state while post update processing was still running. But as of Bug 1875502, we explicitly wait for the update system to initialize before we begin. The initialization includes post update processing, so this should effectively prevent the race condition.

Status: NEW → RESOLVED
Closed: 9 months ago
Duplicate of bug: 1875502
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: