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

Issue 599028 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner: ----
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

big file downloaded through XMLHttpRequest causes crash

Reported by pavel.za...@profiq.cz, Mar 30 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0

Steps to reproduce the problem:
1. extract attachment, there is batch and html file
2. create ~600 MB file using "fsutil file createnew data 600000000"
2. run *.bat file in the attachment
3. it starts chrome, loads html file and downloads 600 MB file
4. crash happens

What is the expected behavior?
no crash

What went wrong?
crash

Crashed report ID: 

How much crashed? Just one tab

Is it a problem with a plugin? No 

Did this work before? N/A 

Chrome version: 49.0.2623.87 m  Channel: stable
OS Version: 7.0
Flash Version: Shockwave Flash 20.0 r0
 
chrome_crash_script_win32.zip
816 bytes Download
Cc: rdsmith@chromium.org
I think this is working as intended; the effect of the script you have is to try and allocate 600MB of memory inside a single tab.  Given that circumstance, I'm inclined to think the right response is for the tab to crash.  What did you want to happen?  


Labels: Needs-Feedback
pavel.zaruba@Could you please respond to comment #1?
Well, my opinion is different. Chromium is used by other 'runtimes', e.g. electron. Let's say an electron app needs to download an update file. When the app is downloading the update, it suddenly crashes. Developers can't inform user since whole process crashed and app window got black. Better would be for example to call abort or error event and inform the app about the error.

	xhr.onabort = function(e) {
	}

	xhr.onerror = function(e) {
	}	


Developers could do something with it in that case. A message could be passed to event handler, sth like 'Insufficient memory' or 'Not enough memory allocated' in case it is memory issue. I've attached screenshot of task manager performance tab before and after the crash.


What comes to "I think this is working as intended", I suppose that the crash is invoked intentionally, something like this:

int *array = malloc(buff_size * sizeof(unsigned char));
if (array == NULL) {
  force_crash();
}

or it is caused unintentionally by "dereferencing null pointer" etc. So I can't think it is working as it should.

Btw is it really problem to allocate 600 MB for Chromium with 1 tab running alone on clear Windows 7 32 bit installation?

crash.png
84.7 KB View Download
Project Member

Comment 4 by sheriffbot@chromium.org, Apr 1 2016

Labels: -Needs-Feedback Needs-Review
Owner: ssamanoori@chromium.org
Thank you for providing more feedback. Adding requester "ssamanoori@chromium.org" for another review and adding "Needs-Review" label for tracking.

For more details visit https://sites.google.com/a/chromium.org/dev/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 5 Deleted

Cc: seththompson@chromium.org
My belief is that we've made the policy decision in Chrome to not allow arbitrary web pages to take up arbitrary amounts of computer memory to avoid DOS attacks, though I grant responding by crashing isn't necessarily the best UI.  Seth: Are you an appropriate person to speak to this?

Chromium is used in Electron (http://electron.atom.io/) as well. So it can be a single page application. The whole app crashes in that case and developer can't do anything about it.

When app creates request and something is wrong with the connection, or with the server, client gets appropriate error (error/abort event handler is called), but if the client loads more and more data, the whole app crashes. That's bad. Why not to simply close the request with error report in the same way as there would be a problem with connection/fetching data on the server? A request can't be fulfilled, so error is thrown. Why crash of whole application? (in Chrome browser sense, just a web page). 


Labels: -Needs-Review
Owner: ----
Components: Blink>Network>XHR
Status: Available (was: Unconfirmed)
We generally don't have OOM handling in the renderer process. But, according to the fetch spec (https://fetch.spec.whatwg.org/) and the XHR spec (https://xhr.spec.whatwg.org/), we should throw a JavaScript exception when we fail to allocate an ArrayBuffer.
Catching exception in an asynchronous code is quite problematic.
See this: https://www.joyent.com/developers/node/design/errors

You couldn't do sth. like this to handle OOM:

try {
    xhr = new XMLHttpRequest();
    xhr.open('GET', url);
    xhr.responseType = 'arraybuffer';
    xhr.send();
    xhr.onprogress = function(e) {};
    xhr.onload = function(e) {};
    xhr.onerror = function(e) {};
    xhr.onabort = function(e) {};
} catch (e) {
    console.log(e);
}

Regarding XHR, terminating fetching and calling onerror when we can't allocate an ArrayBuffer seems the right behavior. 
Yes, it seems to be the right way. Definitely better than a crash.
Project Member

Comment 13 by sheriffbot@chromium.org, Apr 12 2017

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been available for more than 365 days, and should be re-evaluated. Please re-triage this issue.
The Hotlist-Recharge-Cold label is applied for tracking purposes, and should not be removed after re-triaging the issue.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: sigbjo...@opera.com
Status: Fixed (was: Untriaged)
Closing as Fixed - at least part of the problem is fixed.

ArrayBuffer allocation failure is handled by sof@'s change [1].

1: https://chromium.googlesource.com/chromium/src/+/7c838d986a3d95e81971ef40050fecce0ea2be2c

Sign in to add a comment