Open Bug 1564296 Opened 5 years ago Updated 2 years ago

Download finishes "successfully" when download is interrupted by switching network connection

Categories

(Toolkit :: Downloads API, defect, P3)

Unspecified
macOS
defect

Tracking

()

People

(Reporter: glandium, Unassigned)

Details

(Whiteboard: [necko-triaged])

I was downloading an old version of Xcode on developer.apple.com, and realized my wifi connection was on a wifi 802.11g network, while I have a wifi 802.11ac network that would allow the download to finish the download much quicker. So during the download, I just switched wifi.

I was expecting the download to fail, and I would have restarted it from the download panel, but what happened instead was that the download was interrupted, but still successful, and Firefox proceeded to open the downloaded file with the Archive Opener as it was told to do originally. That subsequently failed because the file was not complete.

This was with 67.0.4 on macOS.

If the download finishes "successfully" I expect the network change didn't trickle down to the download manager's stream listeners with an error code, so moving to network to investigate further.

Component: Downloads API → Networking: HTTP
Product: Toolkit → Core

Could you provide the download URL to test with or at least to examine the response headers? If not, one answer may help here: does the download has a known size in the download manager?

Flags: needinfo?(mh+mozilla)

https://download.developer.apple.com/Developer_Tools/Xcode_10/Xcode_10.xip (requires authentication with an apple ID first)

Flags: needinfo?(mh+mozilla)

I was able to reproduce last week, but I can't reproduce this anymore currently.
I can see that the download just failed when I switched wifi, so maybe this was an issue at server side and they already fixed it.

Mike, could you test this again? Thanks.

Flags: needinfo?(mh+mozilla)

It still happens reliably for me, with 67.0.4, 68.0.1 and last nightly.

Flags: needinfo?(mh+mozilla)

The priority flag is not set for this bug.
:michal, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(michal.novotny)
Flags: needinfo?(michal.novotny)
Priority: -- → P2
Whiteboard: [necko-triaged]

I've tried several times to reproduce this today, but I still can't.
Maybe I am not the right one to debug this.
Junior, could you take a look at this?

Flags: needinfo?(juhsu)

I can't reproduce in 68 nor 70 either.
The response header is with content-length: 5876903092

Flags: needinfo?(juhsu)

At this point, we need better steps. Perhaps there's a network configuration or OS difference that impacts this?

Keywords: steps-wanted

Here's a STR that works without having two different ESSIDs:

  • Make sure you're on a wireless network
  • Go to https://developer.apple.com/account/ and login
  • Click "Download tools"
  • Click the blue "Download" button for whatever version of Xcode beta is present today
  • Choose to open the file with Archive Utility
  • Turn wifi off
  • Now if you look at the downloads list, it will show that the Xcode xip file is Canceled.
  • Turn wifi back on
  • As soon as the wifi is connected again, Archive Utility starts and a popup shows up that the file can't be opened because it is from an unidentified developer.
  • Looking at the downloads list, the download is marked as Completed.

This does not happen when downloading some large file from e.g. ftp.mozilla.org. When doing so, turning wifi back on continues the download. In fact, it does so even when the download was explicitly cancelled, which I'm going to file separately because that doesn't seem desirable.

Now, looking at network requests, what happens is that when restoring the download on the Xcode download, Firefox is doing a normal looking request, but the Apple servers reply with a 302 response redirecting to https://developer.apple.com/unauthorized/

Kershaw, does comment #10 help? I can reproduce on 69 beta, at least...

Flags: needinfo?(kershaw)

(In reply to :Gijs (he/him) from comment #11)

Kershaw, does comment #10 help? I can reproduce on 69 beta, at least...

Yes, it helps! I can reproduce this now. I'll take a look.

Flags: needinfo?(kershaw)

The reason that the download is marked as completed is the status code from onStopRequest is NS_OK. But, the request is the redirected one ( https://developer.apple.com/unauthorized/), not the original request (https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_11_Beta_4/Xcode_11_Beta_4.xip).
I didn't check the whole path from nsHttpChannel to DownloadCore.jsm, but it seems to me that DownloadCore.jsm doesn't handle the redirect case well.
So, I'd like to change the component to Downloads API.

Component: Networking: HTTP → Downloads API
Product: Core → Toolkit
Keywords: steps-wanted
Priority: P2 → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.