| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b7a8878 commit 28e298f
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -406,7 +406,7 @@ void OnFatalError(const char* location, const char* message) { | |||
| 406 | 406 | ||
| 407 | 407 | Isolate* isolate = Isolate::GetCurrent(); | |
| 408 | 408 | Environment* env = Environment::GetCurrent(isolate); | |
| 409 | - if (env == nullptr || env->isolate_data()->options()->report_on_fatalerror) { | ||
| 409 | + if (per_process::cli_options->report_on_fatalerror) { | ||
| 410 | 410 | report::TriggerNodeReport( | |
| 411 | 411 | isolate, env, message, "FatalError", "", Local<String>()); | |
| 412 | 412 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -590,10 +590,6 @@ PerIsolateOptionsParser::PerIsolateOptionsParser( | |||
| 590 | 590 | "generate diagnostic report upon receiving signals", | |
| 591 | 591 | &PerIsolateOptions::report_on_signal, | |
| 592 | 592 | kAllowedInEnvironment); | |
| 593 | - AddOption("--report-on-fatalerror", | ||
| 594 | - "generate diagnostic report on fatal (internal) errors", | ||
| 595 | - &PerIsolateOptions::report_on_fatalerror, | ||
| 596 | - kAllowedInEnvironment); | ||
| 597 | 593 | AddOption("--report-signal", | |
| 598 | 594 | "causes diagnostic report to be produced on provided signal," | |
| 599 | 595 | " unsupported in Windows. (default: SIGUSR2)", | |
@@ -667,6 +663,10 @@ PerProcessOptionsParser::PerProcessOptionsParser( | |||
| 667 | 663 | AddOption("--v8-options", | |
| 668 | 664 | "print V8 command line options", | |
| 669 | 665 | &PerProcessOptions::print_v8_help); | |
| 666 | + AddOption("--report-on-fatalerror", | ||
| 667 | + "generate diagnostic report on fatal (internal) errors", | ||
| 668 | + &PerProcessOptions::report_on_fatalerror, | ||
| 669 | + kAllowedInEnvironment); | ||
| 670 | 670 | ||
| 671 | 671 | #ifdef NODE_HAVE_I18N_SUPPORT | |
| 672 | 672 | AddOption("--icu-data-dir", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -186,7 +186,6 @@ class PerIsolateOptions : public Options { | |||
| 186 | 186 | bool no_node_snapshot = false; | |
| 187 | 187 | bool report_uncaught_exception = false; | |
| 188 | 188 | bool report_on_signal = false; | |
| 189 | - bool report_on_fatalerror = false; | ||
| 190 | 189 | bool report_compact = false; | |
| 191 | 190 | std::string report_signal = "SIGUSR2"; | |
| 192 | 191 | std::string report_filename; | |
@@ -236,6 +235,7 @@ class PerProcessOptions : public Options { | |||
| 236 | 235 | std::string use_largepages = "off"; | |
| 237 | 236 | bool trace_sigint = false; | |
| 238 | 237 | std::vector<std::string> cmdline; | |
| 238 | + bool report_on_fatalerror = false; | ||
| 239 | 239 | ||
| 240 | 240 | inline PerIsolateOptions* get_per_isolate_options(); | |
| 241 | 241 | void CheckOptions(std::vector<std::string>* errors) override; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -131,13 +131,13 @@ static void SetSignal(const FunctionCallbackInfo<Value>& info) { | |||
| 131 | 131 | static void ShouldReportOnFatalError(const FunctionCallbackInfo<Value>& info) { | |
| 132 | 132 | Environment* env = Environment::GetCurrent(info); | |
| 133 | 133 | info.GetReturnValue().Set( | |
| 134 | - env->isolate_data()->options()->report_on_fatalerror); | ||
| 134 | + node::per_process::cli_options->report_on_fatalerror); | ||
| 135 | 135 | } | |
| 136 | 136 | ||
| 137 | 137 | static void SetReportOnFatalError(const FunctionCallbackInfo<Value>& info) { | |
| 138 | 138 | Environment* env = Environment::GetCurrent(info); | |
| 139 | 139 | CHECK(info[0]->IsBoolean()); | |
| 140 | - env->isolate_data()->options()->report_on_fatalerror = info[0]->IsTrue(); | ||
| 140 | + node::per_process::cli_options->report_on_fatalerror = info[0]->IsTrue(); | ||
| 141 | 141 | } | |
| 142 | 142 | ||
| 143 | 143 | static void ShouldReportOnSignal(const FunctionCallbackInfo<Value>& info) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | ||
| 3 | - const common = require('../common'); | ||
| 3 | + require('../common'); | ||
| 4 | 4 | const assert = require('assert'); | |
| 5 | 5 | // Testcase to produce report on fatal error (javascript heap OOM) | |
| 6 | 6 | if (process.argv[2] === 'child') { | |
@@ -20,17 +20,26 @@ if (process.argv[2] === 'child') { | |||
| 20 | 20 | const helper = require('../common/report.js'); | |
| 21 | 21 | const tmpdir = require('../common/tmpdir'); | |
| 22 | 22 | tmpdir.refresh(); | |
| 23 | - const spawn = require('child_process').spawn; | ||
| 24 | - const args = ['--report-on-fatalerror', | ||
| 25 | - '--max-old-space-size=20', | ||
| 26 | - __filename, | ||
| 27 | - 'child']; | ||
| 28 | - const child = spawn(process.execPath, args, { cwd: tmpdir.path }); | ||
| 29 | - child.on('exit', common.mustCall((code) => { | ||
| 30 | - assert.notStrictEqual(code, 0, 'Process exited unexpectedly'); | ||
| 31 | - const reports = helper.findReports(child.pid, tmpdir.path); | ||
| 32 | - assert.strictEqual(reports.length, 1); | ||
| 33 | - const report = reports[0]; | ||
| 34 | - helper.validate(report); | ||
| 35 | - })); | ||
| 23 | + const spawnSync = require('child_process').spawnSync; | ||
| 24 | + let args = ['--report-on-fatalerror', | ||
| 25 | + '--max-old-space-size=20', | ||
| 26 | + __filename, | ||
| 27 | + 'child']; | ||
| 28 | + | ||
| 29 | + let child = spawnSync(process.execPath, args, { cwd: tmpdir.path }); | ||
| 30 | + | ||
| 31 | + assert.notStrictEqual(child.status, 0, 'Process exited unexpectedly'); | ||
| 32 | + let reports = helper.findReports(child.pid, tmpdir.path); | ||
| 33 | + assert.strictEqual(reports.length, 1); | ||
| 34 | + const report = reports[0]; | ||
| 35 | + helper.validate(report); | ||
| 36 | + // Verify that reports are not created on fatal error by default. | ||
| 37 | + args = ['--max-old-space-size=20', | ||
| 38 | + __filename, | ||
| 39 | + 'child']; | ||
| 40 | + | ||
| 41 | + child = spawnSync(process.execPath, args, { cwd: tmpdir.path }); | ||
| 42 | + assert.notStrictEqual(child.status, 0, 'Process exited unexpectedly'); | ||
| 43 | + reports = helper.findReports(child.pid, tmpdir.path); | ||
| 44 | + assert.strictEqual(reports.length, 0); | ||
| 36 | 45 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments