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

debugger,test: fix flaky debug logging on SmartOS #3615

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions lib/_debug_agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,25 @@ const Buffer = require('buffer').Buffer;
const Transform = require('stream').Transform;

exports.start = function start() {
var agent = new Agent();
const agent = new Agent();

// SmartOS sometimes munges output from `process._rawDebug()`
// but Windows can't use `console.error()`.
// https://github.com/nodejs/node/issues/2476
const log = process.platform === 'win32' ? process._rawDebug : console.error;
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use common.isWindows

Edit: Nvm. This is not a test.

Copy link
Member

Choose a reason for hiding this comment

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

is _rawDebug out of scope to fix?

Copy link
Member Author

Choose a reason for hiding this comment

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

@jbergstroem I suppose not, although I'm not even sure this is a bug in _rawDebug and not an OS bug. I don't have a SmartOS machine to mess around with.

Copy link
Member

Choose a reason for hiding this comment

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

happy to give you access if you want to tinker around.

Copy link
Member Author

Choose a reason for hiding this comment

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

Cool, I may be in touch. (Going to focus on getting to sleep now.) BTW, it could also go the other way, I imagine, and be a "fix console.error() in this context for Windows" . If that happened, there would be no reason for _rawDebug() to exist. Of course, that might be an impossibility for all I know...

Copy link
Member Author

Choose a reason for hiding this comment

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

@jbergstroem My public keys are at https://github.com/trott.keys. What else would you need to give me access?

Copy link
Member

Choose a reason for hiding this comment

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

@Trott ping me at bugs at bergstroem.nu or jbergstroem@irc.


// Do not let `agent.listen()` request listening from cluster master
const cluster = require('cluster');
cluster.isWorker = false;
cluster.isMaster = true;

agent.on('error', function(err) {
process._rawDebug(err.stack || err);
log(err.stack || err);
});

agent.listen(process._debugAPI.port, function() {
var addr = this.address();
process._rawDebug('Debugger listening on port %d', addr.port);
const addr = this.address();
log(`Debugger listening on port ${addr.port}`);
process._debugAPI.notifyListen();
});

Expand Down
1 change: 0 additions & 1 deletion test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ test-child-process-exit-code : PASS,FLAKY
[$system==macos]

[$system==solaris] # Also applies to SmartOS
test-debug-signal-cluster : PASS,FLAKY

[$system==freebsd]
test-net-socket-local-address : PASS,FLAKY