Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: add --trace-exit cli option #30516

Closed
wants to merge 3 commits into from
Closed

Conversation

@legendecas
Copy link
Member

legendecas commented Nov 17, 2019

It could be convenient to trace abnormal exit of the Node.js processes
that printing stacktrace on each process.exit call with a cli option.
This also takes effects on worker threads.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
@legendecas legendecas added the cli label Nov 17, 2019
doc/api/cli.md Outdated Show resolved Hide resolved
@legendecas legendecas force-pushed the legendecas:trace-exit branch from dbf2329 to fd1f0da Nov 17, 2019
doc/api/cli.md Show resolved Hide resolved
Copy link
Member

addaleax left a comment

👍

src/env.cc Outdated Show resolved Hide resolved
src/env.cc Show resolved Hide resolved
@legendecas legendecas force-pushed the legendecas:trace-exit branch from fd1f0da to 4eb4b5c Nov 20, 2019
@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

}

fprintf(
stderr, "WARNING: Exited the environment with code %d\n", exit_code);

This comment has been minimized.

Copy link
@yorkie

yorkie Nov 22, 2019

Member

Why do we mark this as a warning and pipe to stderr?

This comment has been minimized.

Copy link
@legendecas

legendecas Dec 1, 2019

Author Member

Other traces were printed as warnings and piped to stderr. Do you have any suggestions on the format of the traces?

This comment has been minimized.

Copy link
@yorkie

yorkie Dec 1, 2019

Member

Feel free to resolve this by yourself, I'm okay if this is a default behavior :)

fprintf(stderr, "(node:%d) ", uv_os_getpid());
} else {
fprintf(stderr, "(node:%d, thread:%llu) ", uv_os_getpid(), thread_id());
}

This comment has been minimized.

Copy link
@yorkie

yorkie Nov 22, 2019

Member

Ditto, are this function called always from exceptions?

src/env.cc Show resolved Hide resolved
@vsemozhetbyt

This comment has been minimized.

Copy link
Contributor

vsemozhetbyt commented Nov 23, 2019

It seems doc/node.1 also needs updating.

@jasnell
jasnell approved these changes Dec 1, 2019
Copy link
Member

jasnell left a comment

LGTM once the doc/node.1 is also updated

legendecas added 2 commits Nov 17, 2019
It could be convenient to trace abnormal exit of the Node.js processes
that printing stacktrace on each `process.exit` call with a cli option.
This also takes effects on worker threads.
@legendecas legendecas force-pushed the legendecas:trace-exit branch from 4eb4b5c to 1b99ae9 Dec 6, 2019
@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

added: REPLACEME
-->

Prints a stack trace whenever an environment is been exited proactively, i.e.

This comment has been minimized.

Copy link
@Alhadis

Alhadis Dec 7, 2019

Contributor

Typo: is been should be has been (or simply remove the word been).

doc/node.1 Outdated
@@ -349,6 +349,10 @@ and
.It Fl -trace-events-enabled
Enable the collection of trace event tracing information.
.
.It Fl -trace-exit
Prints a stack trace whenever an environment is been exited proactively, i.e.

This comment has been minimized.

Copy link
@Alhadis

Alhadis Dec 7, 2019

Contributor

See above; the typo has been made here too.

In addition, I recommend putting \& after i.e. to stop troff mistaking it as the end of a sentence. Doing so will stop an uncomfortable gap being inserted due to paragraph justification:

exited proactively, i.e.  invoking  # Without \&
exited proactively, i.e. invoking   # With \&

\& is Roff's “do nothing” character, which is helpful to suppress the behaviour of constructs that have syntactic meaning (for example, starting a line with a dot, which is Roff's way of identifying formatting instructions).

@addaleax

This comment has been minimized.

Copy link
Member

addaleax commented Dec 14, 2019

@legendecas Let me know if there’s anything I can do to help move this along, I’d definitely like to see it happen :)

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@addaleax

This comment has been minimized.

Copy link
Member

addaleax commented Dec 16, 2019

Landed in 6859fcf :)

@addaleax addaleax closed this Dec 16, 2019
addaleax added a commit that referenced this pull request Dec 16, 2019
It could be convenient to trace abnormal exit of the Node.js processes
that printing stacktrace on each `process.exit` call with a cli option.
This also takes effects on worker threads.

PR-URL: #30516
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
@legendecas legendecas deleted the legendecas:trace-exit branch Dec 17, 2019
@legendecas legendecas mentioned this pull request Dec 17, 2019
3 of 3 tasks complete
MylesBorins added a commit that referenced this pull request Dec 17, 2019
It could be convenient to trace abnormal exit of the Node.js processes
that printing stacktrace on each `process.exit` call with a cli option.
This also takes effects on worker threads.

PR-URL: #30516
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Dec 17, 2019
MylesBorins added a commit that referenced this pull request Dec 18, 2019
Notable Changes:

* cli:
  * add --trace-exit cli option (legendecas)
    #30516
* http,https:
  * increase server headers timeout (Tim Costa)
    #30071
* readline:
  * update ansi-regex (Ruben Bridgewater)
    #30907
  * promote \_getCursorPos to public api (Jeremy Albright)
    #30687
* repl:
  * add completion preview (Ruben Bridgewater)
    #30907
* util:
  * add Set and map size to inspect output (Ruben Bridgewater)
    #30225
* wasi:
  * require CLI flag to require() wasi module (Colin Ihrig)
    #30963

PR-URL: #31010
MylesBorins added a commit that referenced this pull request Dec 18, 2019
Notable Changes:

* cli:
  * add --trace-exit cli option (legendecas)
    #30516
* http,https:
  * increase server headers timeout (Tim Costa)
    #30071
* readline:
  * update ansi-regex (Ruben Bridgewater)
    #30907
  * promote \_getCursorPos to public api (Jeremy Albright)
    #30687
* repl:
  * add completion preview (Ruben Bridgewater)
    #30907
* util:
  * add Set and map size to inspect output (Ruben Bridgewater)
    #30225
* wasi:
  * require CLI flag to require() wasi module (Colin Ihrig)
    #30963

PR-URL: #31010
targos added a commit that referenced this pull request Jan 14, 2020
It could be convenient to trace abnormal exit of the Node.js processes
that printing stacktrace on each `process.exit` call with a cli option.
This also takes effects on worker threads.

PR-URL: #30516
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.