Skip to content

bootstrap: adds exception handling for profiler bootstrap - #29552

Closed
shobhitchittora wants to merge 5 commits into
nodejs:masterfrom
shobhitchittora:profiler-bootstrap-exception-handling
Closed

bootstrap: adds exception handling for profiler bootstrap#29552
shobhitchittora wants to merge 5 commits into
nodejs:masterfrom
shobhitchittora:profiler-bootstrap-exception-handling

Conversation

@shobhitchittora

@shobhitchittorashobhitchittora commented Sep 14, 2019

Copy link
Copy Markdown
Contributor

The bootstrapping of profiler failed the script evaluation when inspector is disabled. Adding a try-catch block to handle that and emit a warning.

Fixes: #29542

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

@shobhitchittora
shobhitchittoraforce-pushed the profiler-bootstrap-exception-handling branch from bb08f04 to e9e049eCompareSeptember 14, 2019 00:32
@shobhitchittorashobhitchittora changed the title internal/bootstrap: adds exception handling for profiler bootstrapbootstrap: adds exception handling for profiler bootstrapSep 14, 2019
@shobhitchittora

Copy link
Copy Markdown
ContributorAuthor

@addaleax The warning message can be better here. Any suggestions? Any straightforward way to write a test for this. Thinking of emitting the warning from child to parent and then asserting that.

@devsnek

devsnek commented Sep 14, 2019

Copy link
Copy Markdown
Member

how about "The inspector is disabled, coverage could not be collected"

@devsnekdevsnek added coverage Issues and PRs related to native coverage support. inspector Issues and PRs related to the V8 inspector protocol labels Sep 14, 2019
Comment threadlib/internal/bootstrap/pre_execution.js Outdated
@addaleax

Copy link
Copy Markdown
Member

@addaleax The warning message can be better here. Any suggestions?

I think something along @devsnek’s suggestion is fine.

Any straightforward way to write a test for this. Thinking of emitting the warning from child to parent and then asserting that.

Yeah, spawning a child process that emits this warning and then checking its output would be the easiest way to test this 👍

@shobhitchittora

shobhitchittora commented Sep 15, 2019

Copy link
Copy Markdown
ContributorAuthor

Both
./node ./test/parallel/test-coverage-with-inspector-disabled.js
and
python tools/test.py test/parallel/test-coverage-with-inspector-disabled.js
work fine for me on local, but the test is fails in CI. I might be missing something here. Is the child spawned correctly in the test added?

@addaleaxaddaleax 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.

Both
./node ./test/parallel/test-coverage-with-inspector-disabled.js
and
python tools/test.py test/parallel/test-coverage-with-inspector-disabled.js
work fine for me on local, but the test is fails in CI. I might be missing something here. Is the child spawned correctly in the test added?

I might be wrong, but is there a chance it’s working for you locally because you locally compiled a version of Node.js that has the inspector disabled, but Travis CI builds the default version with inspector enabled?

I think it might make sense to add something like if (process.features.inspector) common.skip('Inspector enabled'); or something like it to the beginning of the test?

Comment threadtest/fixtures/v8-coverage/subprocess.js Outdated
Comment threadtest/parallel/test-coverage-with-inspector-disabled.js Outdated
Comment threadtest/parallel/test-coverage-with-inspector-disabled.js Outdated
Comment threadtest/parallel/test-coverage-with-inspector-disabled.js Outdated
Comment threadlib/internal/bootstrap/pre_execution.js Outdated
@shobhitchittora

Copy link
Copy Markdown
ContributorAuthor

@addaleax Can this be closed and merged now?

@addaleax

Copy link
Copy Markdown
Member

@shobhitchittora Yeah, once CI is green with the latest changes this should be good to go 👍

@addaleaxaddaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Sep 18, 2019
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@Trott

Copy link
Copy Markdown
Member

@shobhitchittora Can you rebase to get rid of the conflict?

@Trott
Trottforce-pushed the profiler-bootstrap-exception-handling branch from 0700615 to bbb315dCompareSeptember 23, 2019 02:17
@Trott

Copy link
Copy Markdown
Member

@shobhitchittora Can you rebase to get rid of the conflict?

Never mind. I did it myself. At least one re-review would be good. @addaleax@joyeecheung

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

addaleax pushed a commit that referenced this pull request Sep 23, 2019
Add exception handling for the case when profile is
not bootstrapped when coverage is enabled.
Fixes: #29542
PR-URL: #29552
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@addaleax

Copy link
Copy Markdown
Member

Landed in fdd5d4a 🎉 Thanks for the PR!

targos pushed a commit that referenced this pull request Sep 23, 2019
Add exception handling for the case when profile is
not bootstrapped when coverage is enabled.
Fixes: #29542
PR-URL: #29552
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@shobhitchittora

Copy link
Copy Markdown
ContributorAuthor

Thanks all for merging this.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.coverageIssues and PRs related to native coverage support.inspectorIssues and PRs related to the V8 inspector protocol

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NODE_V8_COVERAGE does not fail gracefully when inspector is disabled

7 participants

@shobhitchittora@devsnek@addaleax@nodejs-github-bot@Trott@joyeecheung@patilharshal16