Joyee Cheung
491a5c968f
sea: use JSON configuration and blob content for SEA
...
PR-URL: https://github.com/nodejs/node/pull/47125
Refs: https://github.com/nodejs/single-executable/discussions/58
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2023-04-09 18:31:15 +00:00
Chengzhong Wu
3a014dc38a
src: bootstrap prepare stack trace callback in shadow realm
...
Bootstrap per-realm callbacks like `prepare_stack_trace_callback` in
the ShadowRealm. This enables stack trace decoration in the ShadowRealm.
PR-URL: https://github.com/nodejs/node/pull/47107
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-04-04 01:13:37 +00:00
Joyee Cheung
bff7be8210
bootstrap: print stack trace during environment creation failure
...
https://github.com/nodejs/node/pull/45888 took the environment
creation code out of the scope covered by the v8::TryCatch
that we use to print early failures during environment creation.
So e.g. when adding something that would fail in node.js, we get
```
node:internal/options:554: Uncaught Error: Should not query options before bootstrapping is done
```
This patch restores that by adding another v8::TryCatch for it:
```
node:internal/options:20
({ options: optionsMap } = getCLIOptions());
^
Error: Should not query options before bootstrapping is done
at getCLIOptionsFromBinding (node:internal/options:20:32)
at getOptionValue (node:internal/options:45:19)
at node:internal/bootstrap/node:433:29
```
PR-URL: https://github.com/nodejs/node/pull/46533
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2023-02-28 11:06:49 +08:00
Anna Henningsen
b85b5ba10c
src: use string_view for report and related code
...
Use `std::string_view` for process.report code and related
code, drop a few unnecessary `std::to_string` calls,
and use `MaybeStackBuffer` instead of `MallocedBuffer`,
all in order to avoid unnecessary heap allocations.
PR-URL: https://github.com/nodejs/node/pull/46723
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2023-02-20 22:01:45 +00:00
legendecas
71ff89f929
src: rename internal module declaration as internal bindings
...
This is a continuation of the name reification on the internal bindings.
Renames NODE_MODULE_CONTEXT_AWARE_INTERNAL and
NODE_MODULE_EXTERNAL_REFERENCE to NODE_BINDING_CONTEXT_AWARE_INTERNAL
and NODE_BINDING_EXTERNAL_REFERENCE respectively.
PR-URL: https://github.com/nodejs/node/pull/45551
Refs: https://github.com/nodejs/node/issues/44036
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2022-11-29 00:23:08 +08:00
Daeyeon Jeong
7b1e153530
src: simplify exit code accesses
...
This simplifies getting the exit code which is set through
`process.exitCode` by removing manually reading the JS property
from the native side.
Signed-off-by: Daeyeon Jeong <daeyeon.dev@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/45125
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2022-11-10 01:09:18 +00:00
Michaël Zasso
c9602ce212
src: use new v8::OOMErrorCallback API
...
PR-URL: https://github.com/nodejs/node/pull/44741
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2022-10-11 07:27:41 +02:00
Joyee Cheung
be525d7d04
src: consolidate exit codes in the code base
...
Add an ExitCode enum class and use it throughout the code base
instead of hard-coding the exit codes everywhere. At the moment,
the exit codes used in many places do not actually conform to
what the documentation describes. With the new enums (which
are also available to the JS land as constants in an internal
binding) we could migrate to a more consistent usage of the
codes, and eventually expose the constants to the user land
when they are stable enough.
PR-URL: https://github.com/nodejs/node/pull/44746
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2022-10-06 12:41:16 +00:00
Chengzhong Wu
f7896d4671
report: get stack trace with cross origin contexts
...
When a new context with a different security token is entered, or
when no context is entered, `StackTrace::CurrentStackTrace` need to
be explicitly set with flag `kExposeFramesAcrossSecurityOrigins` to
avoid crashing.
PR-URL: https://github.com/nodejs/node/pull/44398
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
2022-09-02 14:02:00 +08:00
Chengzhong Wu
cb15fc56d8
report: expose report public native apis
...
Allows APM vendors to generate a diagnostic report without calling into
JavaScript. Like, from their own message channels interrupting the
isolate and generating a report on demand.
PR-URL: https://github.com/nodejs/node/pull/44255
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2022-08-24 17:02:26 +00:00
legendecas
466710c298
report: print javascript stack on fatal error
...
Try to print JavaScript stack on fatal error. OOMError needs to be
distinguished from fatal error since no new handle can be created at
that time.
PR-URL: https://github.com/nodejs/node/pull/44242
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Michael Dawson <midawson@redhat.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2022-08-20 12:34:34 +08:00
Chengzhong Wu
678551c294
report: skip report if uncaught exception is handled
...
If the exception is handled by the userland
process#uncaughtException handler, reports should not be generated
repetitively as the process may continue to run.
PR-URL: https://github.com/nodejs/node/pull/44208
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2022-08-16 21:04:48 +08:00
legendecas
0a2c910ae9
src,lib: print prinstine source when source map source not found
...
Print unmapped source lines when the source map source is not
found. Error stacks should be correctly mapped even when the
source is absent.
PR-URL: https://github.com/nodejs/node/pull/44052
Refs: https://github.com/nodejs/node/pull/44019
Reviewed-By: Ben Coe <bencoe@gmail.com >
2022-08-06 19:56:27 +08:00
legendecas
a7e5b413ef
src: split property helpers from node::Environment
...
PR-URL: https://github.com/nodejs/node/pull/44056
Refs: https://github.com/nodejs/node/issues/42528
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Feng Yu <F3n67u@outlook.com >
2022-08-02 00:01:02 +08:00
Tobias Nießen
f2afcad582
src: fix bug in GetErrorSource()
...
Refs: https://github.com/nodejs/node/pull/43875
PR-URL: https://github.com/nodejs/node/pull/44019
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Feng Yu <F3n67u@outlook.com >
2022-07-30 16:29:56 +08:00
legendecas
803a7b2b23
src,lib: print source map error source on demand
...
The source context is not prepended to the value of the `stack` property
when the source map is not enabled. Rather than prepending the error
source context to the value of the `stack` property unconditionally,
this patch aligns the behavior and only prints the source context when
the error is not handled by userland (e.g. fatal errors).
Also, this patch fixes that when source-map support is enabled, the
error source context is not pointing to where the error was thrown.
PR-URL: https://github.com/nodejs/node/pull/43875
Fixes: https://github.com/nodejs/node/issues/43186
Fixes: https://github.com/nodejs/node/issues/41541
Reviewed-By: Ben Coe <bencoe@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2022-07-28 08:09:30 +08:00
cola119
223418adf5
src: fix regression that a source marker is lost
...
PR-URL: https://github.com/nodejs/node/pull/43086
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ben Coe <bencoe@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2022-07-25 00:17:35 +08:00
legendecas
02eb10b87b
lib,src: add source map support for global eval
...
Dynamic sources with FunctionConstructor is not supported yet as
V8 prepends lines to the sources which makes the stack line number
incorrect.
PR-URL: https://github.com/nodejs/node/pull/43428
Refs: https://github.com/nodejs/node/issues/43047
Reviewed-By: Ben Coe <bencoe@gmail.com >
2022-07-11 21:44:04 +08:00
Anna Henningsen
200ed07879
src: use Isolate::TryGetCurrent where appropriate
...
In two places, we call `Isolate::GetCurrent()` even though that is
technically invalid usage of the function.
Now that V8 exposes `Isolate::TryGetCurrent()`, we can do this
in a proper way.
PR-URL: https://github.com/nodejs/node/pull/39954
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2021-09-08 18:19:47 +00:00
Divlo
59d3d542d6
errors: disp ver on fatal except that causes exit
...
Display Node.js version at the end of stacktraces
on fatal exception that causes exit.
Easier for debugging so you don't have
to ask "what node version are you on?",
it is directly in the error the user
copy/paste from when asking for help.
Fixes: https://github.com/nodejs/node/issues/29731
PR-URL: https://github.com/nodejs/node/pull/38332
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Michael Dawson <midawson@redhat.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2021-09-08 13:31:07 -04:00
Guy Bedford
e2a6399be7
esm: refine ERR_REQUIRE_ESM errors
...
PR-URL: https://github.com/nodejs/node/pull/39175
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-07-15 08:52:37 -07:00
legendecas
82b1b55122
process: add api to enable source-maps programmatically
...
Add `process.setSourceMapsEnabled` to enable
source-maps programmatically.
PR-URL: https://github.com/nodejs/node/pull/39085
Reviewed-By: Ben Coe <bencoe@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-07-15 19:45:16 +08:00
legendecas
99a3d55784
report: generates report on threads with no isolates
...
PR-URL: https://github.com/nodejs/node/pull/38994
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-14 08:10:54 -07:00
Darshan Sen
fa7cdd6fc9
src: use SPrintF in ProcessEmitWarning
...
PR-URL: https://github.com/nodejs/node/pull/38758
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2021-05-25 07:16:42 -07:00
legendecas
f536cc2e89
src: fix fatal errors when a current isolate not exist
...
napi_fatal_error and node watchdog trigger fatal error but rather
running on a thread that hold no current isolate.
PR-URL: https://github.com/nodejs/node/pull/38624
Reviewed-By: Michael Dawson <midawson@redhat.com >
2021-05-18 09:44:59 +08:00
Michaël Zasso
001dc16cf1
src: use non-deprecated V8 module and script APIs
...
PR-URL: https://github.com/nodejs/node/pull/37330
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-02-25 00:16:41 +01:00
Daniel Bevenius
fc8fcb084d
src: remove unnecessary ToLocalChecked node_errors
...
PR-URL: https://github.com/nodejs/node/pull/36547
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-12-22 09:28:23 +01:00
Anna Henningsen
7069d22343
src: guard against env != null in node_errors.cc
...
Otherwise
`TriggerUncaughtException()`
→ `PrintException()`
→ `GetErrorSource()`
can crash.
PR-URL: https://github.com/nodejs/node/pull/36414
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Shelley Vohr <codebytere@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-12-13 14:28:21 +00:00
Joyee Cheung
7a447bcd54
src: snapshot node
...
This runs `lib/internal/bootstrap/node.js` before creating
the builtin snapshot and deserialize the loaders from the
snapshot in deserialization mode.
PR-URL: https://github.com/nodejs/node/pull/32984
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
2020-07-18 11:23:21 +08:00
himself65
870f0fc5e8
src: add errorProperties on process.report
...
PR-URL: https://github.com/nodejs/node/pull/28426
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-06-26 10:06:22 -07:00
Anna Henningsen
4678e44bb2
src: perform bounds checking on error source line
...
Fixes: https://github.com/nodejs/node/issues/33578
PR-URL: https://github.com/nodejs/node/pull/33645
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-06-09 15:21:45 +02:00
Daniel Bevenius
4a20cc937f
src: remove unused using declarations
...
This commit removes the unused using declarations reported by lint-cpp.
PR-URL: https://github.com/nodejs/node/pull/33268
Refs: https://github.com/nodejs/node/issues/29226
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Christian Clauss <cclauss@me.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com >
2020-05-28 10:02:14 -04:00
bcoe
458677f5ef
errors: print original exception context
...
When --enable-source-maps is set, the error context displayed
above the stack trace now shows original source rather than
transpiled.
PR-URL: https://github.com/nodejs/node/pull/33491
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2020-05-24 22:03:34 -07:00
Anna Henningsen
e0a7fd7d21
src: use basename(argv0) for --trace-uncaught suggestion
...
Refs: https://github.com/nodejs/node/pull/32797#discussion_r407222290
PR-URL: https://github.com/nodejs/node/pull/32798
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
2020-04-15 02:11:43 +02:00
Sam Roberts
fcde1de382
src: sync access for report and openssl options
...
Audited usage of per-process OpenSSL and Report options, adding two
required mutexes.
Also documented existence and typical use of the per-process cli option
mutex.
PR-URL: https://github.com/nodejs/node/pull/32618
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2020-04-08 17:35:07 +02:00
Harshitha KP
2fa74e3e38
report: handle on-fatalerror better
...
--report-on-fatalerror was not honored properly, as there was no
way to check the value which was stored in the Environment pointer
which can be inaccessible under certain fatal error situations.
Move the flag out of Environment pointer so that this is doable.
Co-authored-by: Shobhit Chittora schittora@paypal.com
PR-URL: https://github.com/nodejs/node/pull/32207
Fixes: https://github.com/nodejs/node/issues/31576
Refs: https://github.com/nodejs/node/pull/29881
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
2020-03-25 12:43:45 -07:00
cjihrig
a6bd2c2f81
src: unconditionally include report feature
...
This commit removes all #ifdef NODE_REPORT checks in the src
directory.
PR-URL: https://github.com/nodejs/node/pull/32242
Fixes: https://github.com/nodejs/node/issues/26293
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2020-03-15 13:29:33 -04:00
Ben Noordhuis
3271c40ab1
src: remove fixed-size GetHumanReadableProcessName
...
Remove the version of GetHumanReadableProcessName() that operates on a
fixed-size buffer.
The only remaining caller is Assert() which might get called in contexts
where dynamically allocating memory isn't possible but as Assert() calls
printf(), which also allocates memory when necessary, this commit is
unlikely to make matters much worse.
PR-URL: https://github.com/nodejs/node/pull/31633
Fixes: https://github.com/nodejs/node/issues/31631
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-02-07 23:49:19 +01:00
Anna Henningsen
32e7e813e9
src: use custom fprintf alike to write errors to stderr
...
This allows printing errors that contain nul characters, for example.
Fixes: https://github.com/nodejs/node/issues/28761
Fixes: https://github.com/nodejs/node/issues/31218
PR-URL: https://github.com/nodejs/node/pull/31446
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-01-23 22:39:00 +01:00
legendecas
8baee5e311
src: prevent hard coding stack trace limit
...
Refer to Environment::stack_trace_limit() while printing fresh
stacktraces in c++ land.
PR-URL: https://github.com/nodejs/node/pull/30752
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Denys Otrishko <shishugi@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-12-25 22:29:57 +01:00
Giovanni Campagna
73df09e66b
build: on Android, use android log library to print stack traces
...
And other errors like lost promises
PR-URL: https://github.com/nodejs/node/pull/29388
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Christian Clauss <cclauss@me.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-12-12 09:10:13 -05:00
Anna Henningsen
5b59c24841
src: add more can_call_into_js() guards
...
This is in preparation for running native `SetImmediate()`
callbacks during shutdown.
PR-URL: https://github.com/nodejs/node/pull/30666
Fixes: https://github.com/nodejs/node/issues/30643
Refs: https://github.com/nodejs/node/pull/30374
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-11-28 17:49:11 +01:00
Anna Henningsen
5bf43729a4
src: make EndStartedProfilers an exit hook
...
Run `EndStartedProfilers` on Environment teardown.
This is part of a series of changes to make embedding easier, by
requiring fewer internal methods to build a fully functioning
Node.js instance.
PR-URL: https://github.com/nodejs/node/pull/30229
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Shelley Vohr <codebytere@gmail.com >
2019-11-06 23:26:03 +01:00
Anna Henningsen
31217a8e88
cli: add --trace-uncaught flag
...
Add a flag that makes Node.js print the stack trace at the
time of *throwing* uncaught exceptions, rather than at the
creation of the `Error` object, if there is any.
This is disabled by default because it affects GC behavior.
PR-URL: https://github.com/nodejs/node/pull/30025
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2019-10-22 08:16:18 +02:00
Joyee Cheung
355f2ad466
src: try showing stack traces when process._fatalException is not set
...
So that the stack trace of errors shown in internal code run during
bootstrap (before process._fatalException is set) can be printed.
PR-URL: https://github.com/nodejs/node/pull/29624
Refs: https://github.com/nodejs/node/pull/29593
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2019-09-24 21:24:00 -07:00
Joyee Cheung
b2634238d8
src: disconnect inspector before exiting out of fatal exception
...
So that coverage, .etc are properly written in case of a normal
fatal exception.
PR-URL: https://github.com/nodejs/node/pull/29611
Fixes: https://github.com/nodejs/node/issues/29570
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Ben Coe <bencoe@gmail.com >
2019-09-24 09:55:00 -07:00
cjihrig
36fdf1aa6c
src: allow fatal exceptions to be enhanced
...
This commit allows fatal exceptions to be enhanced so that
exceptions thrown from an unhandledException handler have
the stack attached properly.
PR-URL: https://github.com/nodejs/node/pull/28562
Fixes: https://github.com/nodejs/node/issues/28550
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-07-07 11:55:48 -04:00
Joyee Cheung
94454927f6
process: split routines used to enhance fatal exception stack traces
...
Previously the enhancement were done right after emitting
`'uncaughtException'`, which meant by the time we knew the
exception was fatal in C++, the error.stack had already been
patched.
This patch moves those routines to be called later during the
fatal exception handling, and split them into two stages:
before and after the inspector is notified by the invocation of
`V8Inspector::exceptionThrown`. We now expand the stack to include
additional informations about unhandled 'error' events before
the inspector is notified, but delay the highlighting of the
frames until after the inspector is notified, so that the
ANSI escape sequences won't show up in the inspector console.
PR-URL: https://github.com/nodejs/node/pull/28308
Fixes: https://github.com/nodejs/node/issues/28287
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2019-06-27 20:22:08 +08:00
Joyee Cheung
a33c3c6d33
src: refactor uncaught exception handling
...
The C++ land `node::FatalException()` is not in fact fatal anymore.
It gives the user a chance to handle the uncaught exception
globally by listening to the `uncaughtException` event. This patch
renames it to `TriggerUncaughtException` in C++ to avoid the confusion.
In addition rename the JS land handler to `onGlobalUncaughtException`
to reflect its purpose - we have to keep the alias
`process._fatalException` and use that for now since it has been
monkey-patchable in the user land.
This patch also
- Adds more comments to the global uncaught exception handling routine
- Puts a few other C++ error handling functions into the `errors`
namespace
- Moves error-handling-related bindings to the `errors` binding.
Refs: 2b252acea4
PR-URL: https://github.com/nodejs/node/pull/28257
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
2019-06-19 16:16:37 +08:00
Ben Noordhuis
5872705796
src: restore stdio on program exit
...
Record the state of the stdio file descriptors on start-up and restore
them to that state on exit. This should prevent issues where node.js
sometimes leaves stdio in raw or non-blocking mode.
This is a reworked version of commit c2c9c0c3d3 from May 2018 that was
reverted in commit 14dc17df38 from June 2018. The revert was a little
light on details but I infer that the problem was caused by a missing
call to `uv_tty_reset_mode()`.
Apropos the NOLINT comments: cpplint doesn't understand do/while
statements, it thinks they're while statements without a body.
Fixes: https://github.com/nodejs/node/issues/14752
Fixes: https://github.com/nodejs/node/issues/21020
Original-PR-URL: https://github.com/nodejs/node/pull/20592
PR-URL: https://github.com/nodejs/node/pull/24260
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Refael Ackermann (רפאל פלחי) <refack@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-06-12 20:47:03 -07:00