Bug 209611

Summary: TypedArrays should more gracefully handle OOM during slowDownAndWasteMemory
Product: WebKit Reporter: Keith Miller <keith_miller>
Component: New BugsAssignee: Keith Miller <keith_miller>
Status: RESOLVED FIXED    
Severity: Normal CC: aakash_jain, ap, cgarcia, clopez, dpino, ews-watchlist, guijemont, lmoura, mark.lam, msaboff, pmatos, saam, ticaiolima, tzagallo, webkit-bot-watchers-bugzilla, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch for landing none

Description Keith Miller 2020-03-26 11:39:44 PDT
TypedArrays should more gracefully handle OOM during slowDownAndWasteMemory
Comment 1 Keith Miller 2020-03-26 11:45:36 PDT
Created attachment 394635 [details]
Patch
Comment 2 Keith Miller 2020-03-26 11:46:57 PDT
rdar://problem/60139974
Comment 3 Tadeu Zagallo 2020-03-26 11:52:25 PDT
Comment on attachment 394635 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=394635&action=review

r=me

> Source/JavaScriptCore/API/JSTypedArray.cpp:255
> +            return nullptr;

remove this?

> JSTests/stress/typed-array-oom-in-buffer-accessor.js:1
> +let z = new Float64Array(1000);

How slow is this test?
Comment 4 Keith Miller 2020-03-26 12:45:49 PDT
Comment on attachment 394635 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=394635&action=review

>> Source/JavaScriptCore/API/JSTypedArray.cpp:255
>> +            return nullptr;
> 
> remove this?

Removed.

>> JSTests/stress/typed-array-oom-in-buffer-accessor.js:1
>> +let z = new Float64Array(1000);
> 
> How slow is this test?

1-2s in Debug.
Comment 5 Keith Miller 2020-03-26 12:51:46 PDT
Created attachment 394644 [details]
Patch for landing
Comment 6 EWS 2020-03-26 13:27:08 PDT
Committed r259069: <https://trac.webkit.org/changeset/259069>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 394644 [details].
Comment 7 Aakash Jain 2020-03-27 04:55:08 PDT
(In reply to EWS from comment #6)
> Committed r259069: <https://trac.webkit.org/changeset/259069>
The newly added test stress/typed-array-oom-in-buffer-accessor.js seems to be consistently failing on jsc-armv7 and jsc-mips.

History: https://results.webkit.org/?suite=javascriptcore-tests&suite=javascriptcore-tests&suite=javascriptcore-tests&test=stress%2Ftyped-array-oom-in-buffer-accessor.js.eager-jettison-no-cjit&test=stress%2Ftyped-array-oom-in-buffer-accessor.js.no-llint&test=stress%2Ftyped-array-oom-in-buffer-accessor.js.no-cjit-validate-phases

EWS: https://ews-build.webkit.org/#/builders/26/builds/12663, https://ews-build.webkit.org/#/builders/25/builds/12587

Log: 
stress/typed-array-oom-in-buffer-accessor.js.dfg-eager: Aborted
stress/typed-array-oom-in-buffer-accessor.js.dfg-eager: ERROR: Unexpected exit code: 134
FAIL: stress/typed-array-oom-in-buffer-accessor.js.dfg-eager
Comment 8 Carlos Alberto Lopez Perez 2020-03-27 05:40:49 PDT
(In reply to Aakash Jain from comment #7)
> (In reply to EWS from comment #6)
> > Committed r259069: <https://trac.webkit.org/changeset/259069>
> The newly added test stress/typed-array-oom-in-buffer-accessor.js seems to
> be consistently failing on jsc-armv7 and jsc-mips.
> 
> History:
> https://results.webkit.org/?suite=javascriptcore-tests&suite=javascriptcore-
> tests&suite=javascriptcore-tests&test=stress%2Ftyped-array-oom-in-buffer-
> accessor.js.eager-jettison-no-cjit&test=stress%2Ftyped-array-oom-in-buffer-
> accessor.js.no-llint&test=stress%2Ftyped-array-oom-in-buffer-accessor.js.no-
> cjit-validate-phases
> 
> EWS: https://ews-build.webkit.org/#/builders/26/builds/12663,
> https://ews-build.webkit.org/#/builders/25/builds/12587
> 
> Log: 
> stress/typed-array-oom-in-buffer-accessor.js.dfg-eager: Aborted
> stress/typed-array-oom-in-buffer-accessor.js.dfg-eager: ERROR: Unexpected
> exit code: 134
> FAIL: stress/typed-array-oom-in-buffer-accessor.js.dfg-eager

If this tests require to allocate more than 512MB of RAM then they need to have this at the top:
//@ skip if $memoryLimited

And then the ARMv7 and MIPS JSC testers should skip this tests. We run the testers on boards with only 2GB of RAM, also Linux doesn't handle OOM situations as good as Mac/iOS, so this testers run with $memoryLimited config option enabled.
Comment 9 Paulo Matos 2020-03-27 10:23:51 PDT
(In reply to Carlos Alberto Lopez Perez from comment #8)
> (In reply to Aakash Jain from comment #7)
> > (In reply to EWS from comment #6)
> > > Committed r259069: <https://trac.webkit.org/changeset/259069>
> > The newly added test stress/typed-array-oom-in-buffer-accessor.js seems to
> > be consistently failing on jsc-armv7 and jsc-mips.
> > 
> > History:
> > https://results.webkit.org/?suite=javascriptcore-tests&suite=javascriptcore-
> > tests&suite=javascriptcore-tests&test=stress%2Ftyped-array-oom-in-buffer-
> > accessor.js.eager-jettison-no-cjit&test=stress%2Ftyped-array-oom-in-buffer-
> > accessor.js.no-llint&test=stress%2Ftyped-array-oom-in-buffer-accessor.js.no-
> > cjit-validate-phases
> > 
> > EWS: https://ews-build.webkit.org/#/builders/26/builds/12663,
> > https://ews-build.webkit.org/#/builders/25/builds/12587
> > 
> > Log: 
> > stress/typed-array-oom-in-buffer-accessor.js.dfg-eager: Aborted
> > stress/typed-array-oom-in-buffer-accessor.js.dfg-eager: ERROR: Unexpected
> > exit code: 134
> > FAIL: stress/typed-array-oom-in-buffer-accessor.js.dfg-eager
> 
> If this tests require to allocate more than 512MB of RAM then they need to
> have this at the top:
> //@ skip if $memoryLimited
> 
> And then the ARMv7 and MIPS JSC testers should skip this tests. We run the
> testers on boards with only 2GB of RAM, also Linux doesn't handle OOM
> situations as good as Mac/iOS, so this testers run with $memoryLimited
> config option enabled.

Added bug 209661