mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
7f496fefb6
`Environment::GetCurrent` may not available in the context of OOM. Removes the cyclic `Environment::GetCurrent` and `env->isolate()` calls to ensure both `isolate` and `env` is present if available. However, this behavior is not guaranteed. As `Environment::GetCurrent` didn't allocate new handles in the heap, when a Context is entered it can still get the valid env pointer. Removes the unstable assertion of the absence of env in the test. PR-URL: https://github.com/nodejs/node/pull/44398 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
27 lines
851 B
JavaScript
27 lines
851 B
JavaScript
'use strict';
|
|
|
|
// Testcases for situations involving fatal errors, like Javascript heap OOM
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const helper = require('../common/report.js');
|
|
const spawnSync = require('child_process').spawnSync;
|
|
const tmpdir = require('../common/tmpdir');
|
|
const fixtures = require('../common/fixtures');
|
|
|
|
// Common args that will cause an out-of-memory error for child process.
|
|
const ARGS = [
|
|
'--max-heap-size=20',
|
|
fixtures.path('report-oom'),
|
|
];
|
|
|
|
{
|
|
tmpdir.refresh();
|
|
// Verify that --report-on-fatalerror is respected when not set.
|
|
const args = ARGS;
|
|
const child = spawnSync(process.execPath, args, { cwd: tmpdir.path });
|
|
assert.notStrictEqual(child.status, 0, 'Process exited unexpectedly');
|
|
const reports = helper.findReports(child.pid, tmpdir.path);
|
|
assert.strictEqual(reports.length, 0);
|
|
}
|