Skip to content

report: skip report if uncaught exception is handled - #44208

Closed
legendecas wants to merge 4 commits into
nodejs:mainfrom
legendecas:report-uncaught-exception
Closed

legendecas wants to merge 4 commits into
nodejs:mainfrom
legendecas:report-uncaught-exception

Conversation

@legendecas

@legendecas legendecas commented Aug 11, 2022 •

Copy link
Copy Markdown
Member

If the exception is handled by the userland
process#uncaughtException handler, reports should not be generated
repetitively as the process may continue to run.

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. process Issues and PRs related to the process subsystem. labels Aug 11, 2022
@legendecas
legendecas force-pushed the report-uncaught-exception branch from d8e0d9f to ecafaa4 Compare August 11, 2022 03:34
If the exception is handled by the userland
process#uncaughtException handler, reports should not be generated
repetitively as the process may continue to run.
@legendecas
legendecas force-pushed the report-uncaught-exception branch from ecafaa4 to 360e9f7 Compare August 11, 2022 03:39
@legendecas

ghost commented Aug 11, 2022 •

Copy link
Copy Markdown
Member Author

@nodejs/diagnostics @gireeshpunathil would you mind taking a look at this PR? thank you!

ghost left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @legendecas 👋

The only thing that makes me fear (as a newcomer in the codebase) is to guess the intention when you set process.report.directory in the test files.:

process.report.directory = <something>

Maybe a comment could help? WDYT

@legendecas

ghost commented Aug 12, 2022

Copy link
Copy Markdown
Member Author

@tony-go without setting the report directory to the designated temp file directory, the report can be generated in the process's current working directory, which can vary if you run the test in different ways. Also, the temp file directory is clean up after the test is done, which can reduce the burden to manage the test generated files.

@legendecas legendecas added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Aug 12, 2022
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Aug 12, 2022
@nodejs-github-bot

ghost commented Aug 12, 2022

Copy link
Copy Markdown
Collaborator

@legendecas

ghost commented Aug 12, 2022

Copy link
Copy Markdown
Member Author

Updated with spawning child process with cwd set to the designated temp dir and removing the assignments to process.report.directory.

@tony-go

ghost commented Aug 12, 2022

Copy link
Copy Markdown
Member

@tony-go without setting the report directory to the designated temp file directory, the report can be generated in the process's current working directory, which can vary if you run the test in different ways. Also, the temp file directory is clean up after the test is done, which can reduce the burden to manage the test generated files.

Thanks for the details 🙌🏼

tmpdir.path,
]);
], {
cwd: tmpdir.path,

ghost Aug 12, 2022

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

ghost left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@gireeshpunathil

ghost commented Aug 14, 2022 •

Copy link
Copy Markdown
Member
  • does it require any doc changes?
  • does this change make it semver major?

@legendecas

ghost commented Aug 14, 2022 •

Copy link
Copy Markdown
Member Author

@gireeshpunathil I'd find this could be categorized as a fix as I would not count handled "uncaught exception" as an uncaught event, and we don't have tests asserting that the report can be generated repetitively. However, this can be considered a breaking change as it has been there for such a long time.

I've updated the document to reflect that the report is only generated when the process is exiting for uncaught exceptions, which excluded the conditions where uncaught exceptions are handled.

Comment thread doc/api/cli.md Resolved
@legendecas legendecas added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Aug 15, 2022
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Aug 15, 2022
@nodejs-github-bot

ghost commented Aug 15, 2022 •

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

ghost commented Aug 15, 2022

Copy link
Copy Markdown
Collaborator

@legendecas

ghost commented Aug 16, 2022

Copy link
Copy Markdown
Member Author

Landed in 678551c. Thank you for the review!

@legendecas legendecas closed this Aug 16, 2022
@legendecas
legendecas deleted the report-uncaught-exception branch August 16, 2022 13:06
@juanarbol juanarbol mentioned this pull request Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. process Issues and PRs related to the process subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants