Skip to content

Conversation

@killagu
Copy link
Contributor

@killagukillagu commented Feb 8, 2018

node --prof foo.js may not print the full profile log file,
the last line will broken like tick, and not more blank line.
readlinewill stuck in infinite loop, add bytes < buf.length
will fix it.

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
Affected core subsystem(s)

@bnoordhuis

@nodejs-github-botnodejs-github-bot added the tools Issues and PRs related to the tools directory. label Feb 8, 2018
@killagu
Copy link
ContributorAuthor

node v9.4.0 and v9.5.0 may not print the full profile log file when use the ctrl-c close the process.

Copy link
Contributor

@mmarchinimmarchiniFeb 8, 2018

Choose a reason for hiding this comment

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

typo s/BORKEN_PART/BROKEN_PART/

Also, could we just use const BROKEN_PART = 'tick,'/ instead? "0x100840650" looks like a magic number here.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

yes,it's better.

@killagu
Copy link
ContributorAuthor

@mmarchini the magic number have been removed.

@Fishrock123
Copy link
Contributor

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure whether the linter (make lint) will complain or not, but this is difficult to read. Please use braces here.

@killagukillaguforce-pushed the fix-prof-polyfill branch 2 times, most recently from 479f168 to fd9baf5CompareFebruary 11, 2018 02:33
Copy link
Contributor

Choose a reason for hiding this comment

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

emit a warning while broken?

`node --prof foo.js` may not print the full profile log file, the last line will broken like `tick,` and not more blank line. `readline`will stuck in infinite loop, add `bytes === 0` will fix it.
Copy link
Contributor

@XadillaXXadillaX left a comment

Choose a reason for hiding this comment

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

LGTM if CI is OK.

@XadillaX
Copy link
Contributor

@XadillaX
Copy link
Contributor

exports.restoreStdout=restoreWritable.bind(null,'stdout');
exports.restoreStderr=restoreWritable.bind(null,'stderr');
exports.isSymbolAvailable=exports.isWindows||
exports.isSunOS||
Copy link
Contributor

@XadillaXXadillaXFeb 11, 2018

Choose a reason for hiding this comment

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

nit: align with exports above.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@XadillaX as you wish.


Platform check for Windows 32-bit on Windows 64-bit.

### isSymbolAvailable
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use a more descriptive name than this please?

Copy link
ContributorAuthor

@killagukillaguFeb 12, 2018

Choose a reason for hiding this comment

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

my bad,it should be isCPPSymbolsNotMapped. @cjihrig

### isSymbolAvailable
*[&lt;Boolean>]

Platform check for if symbol available.
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly, can you provide a more in depth description.

@killagu
Copy link
ContributorAuthor

@cjihrig the property name,and readme have been changed to more descriptive.

*[&lt;Boolean>]

Platform check for if symbol available.
Platform check for c++ symbols are mapped or not.
Copy link
Contributor

Choose a reason for hiding this comment

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

c++ => C++

Copy link
Contributor

@mmarchinimmarchini left a comment

Choose a reason for hiding this comment

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

tmpdir.refresh();

if(!common.enoughTestCpu)
common.skip('test is CPU-intensive');
Copy link
Member

Choose a reason for hiding this comment

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

Nit: would you be so kind and use a capital letter as first character? :-)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

In the node test,the first character in skip message is always lower case.

common.skip('test is CPU-intensive');

if(common.isCPPSymbolsNotMapped){
common.skip('C++ symbols are not mapped for this os.');
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Operating system should be upper cased as in OS.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Thank you for the advice.It should be upper cased.


//This test will produce a broken profile log.
//ensure prof-polyfill not stuck in infinite loop
//and success process
Copy link
Member

Choose a reason for hiding this comment

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

Nit: please use a space at the beginning of each line in a comment.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Thank you for the advice.It should have a space at the beginning of each line.

this.ts = Date.now();
setImmediate(function(){new f()});
};
f();`;
Copy link
Member

Choose a reason for hiding this comment

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

Nit: we have the unwritten rule not to use multi line template strings.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Thank you for the advice.I will split it to two lines.

'--prof-process',LOG_FILE
]);
assert(WARN_REG_EXP.test(child.stderr.toString()));
assert.strictEqual(child.status,0,'broken file should success too');
Copy link
Member

Choose a reason for hiding this comment

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

I personally would like to stick to the default message.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

The default message will be removed.

return'';
}
if(bytes===0){
process.emitWarning('profile file is broken',{
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: you might just add the filename of the broken file? And please use a capital letter as first character.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Thank you for the advice.Add the filename is better.

fix warn message fix comment style
@killagu
Copy link
ContributorAuthor

@BridgeAR Thank you for the advice.I have update the code.Please review it.

@BridgeARBridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Feb 17, 2018
@BridgeAR
Copy link
Member

mmarchini pushed a commit that referenced this pull request Feb 17, 2018
`node --prof foo.js` may not print the full profile log file, leaving the last line broken (for example `tick,`. When that happens, `readline` will be stuck in an infinite loop. This patch fixes it. Also introduced `common.isCPPSymbolsNotMapped` to avoid duplicated code on tick-processor tests. PR-URL: #18641 Reviewed-By: Khaidi Chu <[email protected]> Reviewed-By: Matheus Marchini <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
@mmarchini
Copy link
Contributor

Landed in 38f04d4 😄

@MylesBorins
Copy link
Contributor

Should this be backported to v9.x-staging? If yes please follow the guide and raise a backport PR, if not let me know or add the dont-land-on label.

@killagu
Copy link
ContributorAuthor

@MylesBorins It should be backported to v9.x-staging,and I will raise a backport PR.

killagu added a commit to killagu/node that referenced this pull request Feb 21, 2018
`node --prof foo.js` may not print the full profile log file, leaving the last line broken (for example `tick,`. When that happens, `readline` will be stuck in an infinite loop. This patch fixes it. Also introduced `common.isCPPSymbolsNotMapped` to avoid duplicated code on tick-processor tests. PR-URL: nodejs#18641 Reviewed-By: Khaidi Chu <[email protected]> Reviewed-By: Matheus Marchini <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
@killagu
Copy link
ContributorAuthor

@MylesBorins I have raised a PR to backport it.

BTW I have no permission for run the CI. If you can help me trigger the CI, you are so kind.

killagu added a commit to killagu/node that referenced this pull request Feb 22, 2018
`node --prof foo.js` may not print the full profile log file, leaving the last line broken (for example `tick,`. When that happens, `readline` will be stuck in an infinite loop. This patch fixes it. Also introduced `common.isCPPSymbolsNotMapped` to avoid duplicated code on tick-processor tests. PR-URL: nodejs#18641 Reviewed-By: Khaidi Chu <[email protected]> Reviewed-By: Matheus Marchini <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
addaleax pushed a commit that referenced this pull request Feb 26, 2018
`node --prof foo.js` may not print the full profile log file, leaving the last line broken (for example `tick,`. When that happens, `readline` will be stuck in an infinite loop. This patch fixes it. Also introduced `common.isCPPSymbolsNotMapped` to avoid duplicated code on tick-processor tests. Backport-PR-URL: #18901 PR-URL: #18641 Reviewed-By: Khaidi Chu <[email protected]> Reviewed-By: Matheus Marchini <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
addaleax pushed a commit that referenced this pull request Feb 26, 2018
`node --prof foo.js` may not print the full profile log file, leaving the last line broken (for example `tick,`. When that happens, `readline` will be stuck in an infinite loop. This patch fixes it. Also introduced `common.isCPPSymbolsNotMapped` to avoid duplicated code on tick-processor tests. Backport-PR-URL: #18901 PR-URL: #18641 Reviewed-By: Khaidi Chu <[email protected]> Reviewed-By: Matheus Marchini <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
@addaleaxaddaleax mentioned this pull request Feb 27, 2018
MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
`node --prof foo.js` may not print the full profile log file, leaving the last line broken (for example `tick,`. When that happens, `readline` will be stuck in an infinite loop. This patch fixes it. Also introduced `common.isCPPSymbolsNotMapped` to avoid duplicated code on tick-processor tests. PR-URL: nodejs#18641 Reviewed-By: Khaidi Chu <[email protected]> Reviewed-By: Matheus Marchini <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
MylesBorins pushed a commit that referenced this pull request Aug 7, 2018
`node --prof foo.js` may not print the full profile log file, leaving the last line broken (for example `tick,`. When that happens, `readline` will be stuck in an infinite loop. This patch fixes it. Also introduced `common.isCPPSymbolsNotMapped` to avoid duplicated code on tick-processor tests. Backport-PR-URL: #18901 PR-URL: #18641 Reviewed-By: Khaidi Chu <[email protected]> Reviewed-By: Matheus Marchini <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
rvagg pushed a commit that referenced this pull request Aug 16, 2018
`node --prof foo.js` may not print the full profile log file, leaving the last line broken (for example `tick,`. When that happens, `readline` will be stuck in an infinite loop. This patch fixes it. Also introduced `common.isCPPSymbolsNotMapped` to avoid duplicated code on tick-processor tests. Backport-PR-URL: #18901 PR-URL: #18641 Reviewed-By: Khaidi Chu <[email protected]> Reviewed-By: Matheus Marchini <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
@MylesBorinsMylesBorins mentioned this pull request Aug 16, 2018
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.toolsIssues and PRs related to the tools directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@killagu@Fishrock123@XadillaX@BridgeAR@mmarchini@MylesBorins@cjihrig@addaleax@nodejs-github-bot