New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 595305 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 1
Type: Bug-Regression



Sign in to add a comment

Invoking revokeObjectURL after downloading file as blob results in a Failed - No file error

Reported by i...@slimapplications.com, Mar 16 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.26 Safari/537.36

Example URL:
See test code below

Steps to reproduce the problem:
1. Use XHR to download a document asynchronously
2. Create a MouseEvent and dispatch it
3. Invoke the revokeObjectURL to release memory

What is the expected behavior?
The file is downloaded and the blob is no longer listed  under chrome://blob-internals/

What went wrong?
The download reports an error "Failed - No file" on Chrome 50.0.2661.26 beta.
The same code works fine on Chrome 49.0 (stable) and Opera.

Invoking the revokeObjectURL with a delay using setTimeout circumvents the problem.

Question: is this behaviour by design in Chrome v50?
if so, I need to modify my code to cater for this new behaviour of Chrome when using revokeObjectURL.

see attached file for screenshot of the error and a code fragment to test.

Did this work before? Yes Chrome v49 stable

Chrome version: 50.0.2661.26  Channel: beta
OS Version: 10.0
Flash Version: Shockwave Flash 21.0 r0

There is a workaround by invoking the revokeObjectURL with a delay but this is not optimal.
 
Chrome 50.0.2661.26 beta bug with revokeObjectURL.docx
19.7 KB Download
Components: -Internals>Network Blink>FileAPI Blink>Storage Blink>Forms>File
Slapping some aggressive Blink labels on it, in the hopes that someone who knows the Blob implementation can chime in. I assume Blink>FileAPI should be sufficient, but since Storage & <file> also use it, there may be knowledge there.

Comment 2 by tkent@chromium.org, Mar 17 2016

Components: -Blink>Forms>File
Labels: Needs-Bisect

Comment 3 by jsb...@chromium.org, Mar 17 2016

Components: -Blink>Storage
Blink>FileAPI is sufficient, we triage/own both (it should maybe be Blink>Storage>FileAPI)

Comment 4 by jsb...@chromium.org, Mar 17 2016

Cc: michaeln@chromium.org jsb...@chromium.org
Owner: dmu...@chromium.org
Cc: ranjitkan@chromium.org
Labels: Needs-Feedback
Tried creating the html file from the provided Document and clicking the link does not downloads any file. It gives the following error in console(Screen Shot provided).

Could some one please guide us for the same.

Thanks.!
Screen Shot 2016-03-18 at 1.23.18 PM.png
177 KB View Download
Hi, the html file(s) needs to be uploaded to a web server. Upon opening the html file named downloadFile_Pass.html in Chrome and the clicking the link the html file itself is downloaded. In the case of downloadFile_Fail.html the "Failed - No file" error is shown.  thanks for looking into this.
downloadFile_Fail.html
982 bytes View Download
downloadFile_Pass.html
984 bytes View Download
Addition to comment 6.
I have uploaded the files to a web server. Please see:
http://www.iq-solutions.nl/downloadFile_Fail.html
http://www.iq-solutions.nl/downloadFile_Pass.html
thanks
Project Member

Comment 8 by sheriffbot@chromium.org, Mar 18 2016

Labels: -Needs-Feedback Needs-Review
Owner: ranjitkan@chromium.org
Status: Assigned (was: Unconfirmed)
Thank you for providing more feedback. Assigning to requester "ranjitkan@chromium.org" for another review.

For more details visit https://sites.google.com/a/chromium.org/dev/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: dmu...@chromium.org
Labels: -Needs-Review Needs-Feedback
Owner: ----
Status: Unconfirmed (was: Assigned)
Thanks for the details provided. I was able to download both the files from the above two links on build "50.0.2661.37" Beta and Canary - 51.0.2686.0. Same result is observed on Stable 49.0.2623.87.

And please let us know what is that we need to verify under "chrome://blob-internals/"

A screen shot would be more helpful.

Thanks.!


Hi, please find attached a Word file with the requested details. 
Clicking on the link "download current file" after opening the file  downloadFile_Fail.html results in an error "Failed - No File" on Chrome 50. This works fine on Chrome 49. 
Note: the download of the blob is handled through mimicing a mouse event. Any chance that is now done asynchronously in v50?
thanks
Test findings Chrome bug 595305 21-03-2016.docx
272 KB Download
Labels: -Type-Bug -Needs-Feedback -Needs-Bisect M-50 hasbisect OS-Linux OS-Mac Type-Bug-Regression
Owner: asanka@chromium.org
Status: Assigned (was: Unconfirmed)
Thanks a lot for the details provided. Able to reproduce the issue on Windows, MAC 10.11.3, Ubuntu 14.04 and is a regression broken in M50 builds. below are bisect details for the same.

Bisect info:
============
50.0.2634.0 - Good build
50.0.2635.0 - Bad build

Bisect URL: https://chromium.googlesource.com/chromium/src/+log/eac0ccddbbc380e8960228a7989e31a8135fa209..3c4b22daaa8bc6f5ea7da25af0b7c1a7aa957b09

Suspecting the below change could be the possible suspect:

https://chromium.googlesource.com/chromium/src/+/bb028fc67f0835b30bd2ce5d953caa101c15c961

Review URL: https://codereview.chromium.org/1644743003

@asanka: Request you to please take a look into it. Please help us to reassign if not with respect to your change.


The CL mentioned in #11 affects the timing between the download "starting" and the time at which revokeObjectURL() effectively releases the Blob URL. If the download start prior to revokeObjectURL(), then ResourceDispatcherHostImpl will obtain a handle to the blob data and attach it to the URLRequest via a UserData object. If the download loses the race, then the blob would no longer be around by the time ResourceDispatcherHostImpl looks at blob storage.

That said, I'm not sure whether the browser should offer the guarantee that dispatching a click event on an anchor with @download gives the impression of starting synchronously to the extent that revoking the URL immediately afterwards is inconsequential.
Does the DownloadUrl message get sent prior to return from dispatching the click event in blink? If so, it'd be straightforward to grab a blobhandle in DownloadUrl and to include it in the DownloadUrlParameters.

I think that might be necessary even if the message is not sent prior to return from dispatching the click event, although if the ipc is deferred that change is insufficient.

Labels: -Pri-2 Pri-1
#13: yeah, we can get a BlobHandle and pass it along with the DownloadUrlParameters at the point when the renderer receives the DownloadUrl IPC on the IO thread.
Labels: -OS-Linux -OS-Windows -Arch-x86_64 -OS-Mac OS-All
https://codereview.chromium.org/1829413002
Project Member

Comment 16 by bugdroid1@chromium.org, Mar 25 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6150c52a037d3b05eeac0faaf792ab0203b5580f

commit 6150c52a037d3b05eeac0faaf792ab0203b5580f
Author: asanka <asanka@chromium.org>
Date: Fri Mar 25 21:40:57 2016

[Downloads] Retain a BlobDataHandle in DownloadUrlParameters.

This allows a caller to extend the lifetime of a blob until the
downloads / resource loader subsystems take over. Without this, an
unfortunately timed revokeObjectURL() call from the originating page may
invalidate the URL before the download has a chance to start the
associated download request.

BUG= 595305 

Review URL: https://codereview.chromium.org/1829413002

Cr-Commit-Position: refs/heads/master@{#383370}

[modify] https://crrev.com/6150c52a037d3b05eeac0faaf792ab0203b5580f/content/browser/download/download_browsertest.cc
[modify] https://crrev.com/6150c52a037d3b05eeac0faaf792ab0203b5580f/content/browser/download/download_manager_impl.cc
[modify] https://crrev.com/6150c52a037d3b05eeac0faaf792ab0203b5580f/content/browser/loader/resource_dispatcher_host_impl.cc
[modify] https://crrev.com/6150c52a037d3b05eeac0faaf792ab0203b5580f/content/browser/renderer_host/render_message_filter.cc
[modify] https://crrev.com/6150c52a037d3b05eeac0faaf792ab0203b5580f/content/public/browser/download_url_parameters.h
[add] https://crrev.com/6150c52a037d3b05eeac0faaf792ab0203b5580f/content/test/data/download/download-attribute-blob.html
[add] https://crrev.com/6150c52a037d3b05eeac0faaf792ab0203b5580f/content/test/data/download/download-attribute-blob.html.mock-http-headers

Status: Fixed (was: Assigned)
I'll wait for a Canary or two before requesting a merge.
Labels: Merge-Request-50
Requesting merge. This regression dates back to crrev.com/bb028fc67f0835b30bd2ce5d953caa101c15c961 which was pulled into M50.

The change has baked in Canary over the weekend and introduced no new crashes.

Comment 19 by tin...@google.com, Mar 28 2016

Labels: -Merge-Request-50 Merge-Approved-50 Hotlist-Merge-Approved
Your change meets the bar and is auto-approved for M50 (branch: 2661)
Project Member

Comment 20 by bugdroid1@chromium.org, Mar 28 2016

Labels: -merge-approved-50 merge-merged-2661
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/58242aeb11363fe0436724aefdc56faaf53321e4

commit 58242aeb11363fe0436724aefdc56faaf53321e4
Author: Asanka Herath <asanka@chromium.org>
Date: Mon Mar 28 15:38:42 2016

[Merge M50] [Downloads] Retain a BlobDataHandle in DownloadUrlParameters.

This allows a caller to extend the lifetime of a blob until the
downloads / resource loader subsystems take over. Without this, an
unfortunately timed revokeObjectURL() call from the originating page may
invalidate the URL before the download has a chance to start the
associated download request.

BUG= 595305 

Review URL: https://codereview.chromium.org/1829413002

Cr-Commit-Position: refs/heads/master@{#383370}
(cherry picked from commit 6150c52a037d3b05eeac0faaf792ab0203b5580f)

Review URL: https://codereview.chromium.org/1835913002 .

Cr-Commit-Position: refs/branch-heads/2661@{#403}
Cr-Branched-From: ef6f6ae5e4c96622286b563658d5cd62a6cf1197-refs/heads/master@{#378081}

[modify] https://crrev.com/58242aeb11363fe0436724aefdc56faaf53321e4/content/browser/download/download_browsertest.cc
[modify] https://crrev.com/58242aeb11363fe0436724aefdc56faaf53321e4/content/browser/download/download_manager_impl.cc
[modify] https://crrev.com/58242aeb11363fe0436724aefdc56faaf53321e4/content/browser/loader/resource_dispatcher_host_impl.cc
[modify] https://crrev.com/58242aeb11363fe0436724aefdc56faaf53321e4/content/browser/renderer_host/render_message_filter.cc
[modify] https://crrev.com/58242aeb11363fe0436724aefdc56faaf53321e4/content/public/browser/download_url_parameters.h
[add] https://crrev.com/58242aeb11363fe0436724aefdc56faaf53321e4/content/test/data/download/download-attribute-blob.html
[add] https://crrev.com/58242aeb11363fe0436724aefdc56faaf53321e4/content/test/data/download/download-attribute-blob.html.mock-http-headers

 Issue 597003  has been merged into this issue.
Labels: TE-Verified-M50 TE-Verified-50.0.2661.57
Tested the issue on windows 7, Linux Ubuntu 14.04 and Mac 10.11.3 using chrome version 50.0.2661.57.
Not observed the error "Failed - No File" when clicked on "download current file" from downloadFile_Fail.html.
Please find the attached screen cast for the same.

adding TE-Verified

595305.mp4
530 KB Download
Components: Blink>Storage>FileAPI
Components: -Blink>FileAPI

Sign in to add a comment