-
Notifications
You must be signed in to change notification settings - Fork 167
Open
Description
Here's a an example that causes an OOM and an ungraceful exit with isolated-vm:
const ivm = require("isolated-vm");
const isolate = new ivm.Isolate({memoryLimit: 512});
const context = isolate.createContextSync();
context.evalClosureSync(`
const arrayBuffer = new ArrayBuffer(100 * 1024 * 1024);
let view = new Array(arrayBuffer.byteLength);
let array = new Uint8Array(arrayBuffer);
let i = view.length;
while (i--) {
view[i] = array[i];
}
`);
Output:
<--- JS stacktrace --->
CALL_AND_RETRY_LAST
is_heap_oom = 1
<--- Heap statistics --->
total_heap_size = 203489280
total_heap_size_executable = 262144
total_physical_size = 201801728
total_available_size = 360626944
used_heap_size = 201638712
heap_size_limit = 562036736
malloced_memory = 49256
peak_malloced_memory = 254976
does_zap_garbage = 0
Abort trap: 6
Would appreciate some help in understanding whether this is a bug somewhere in isolated-vm or V8 and how a Node.js process can be more resilient against failures like this.
Metadata
Metadata
Assignees
Labels
No labels