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

Segmentation fault in native call binding.runInDebugContext #5217

Closed
akoskm opened this issue Feb 13, 2016 · 4 comments
Closed

Segmentation fault in native call binding.runInDebugContext #5217

akoskm opened this issue Feb 13, 2016 · 4 comments
Labels
util Issues and PRs related to the built-in util module.

Comments

@akoskm
Copy link

akoskm commented Feb 13, 2016

Hello!

I ran into this issue when I started using log4js with mongoose in node 4.3.0, so I'm not sure if there is an incompatibility or a bug. Because there is a Segmentation fault which I tracked down to a native call in node, I'm posting this here.

req.app.logger.debug('User created:', user);

When I'm trying to log this message - where the user is a Mongoose Document and logger is a log4js logger instance - here is what leads to the Segmentation fault, step by step:

At some point log4js calls formatLogData in util

function formatLogData(logData) {
  var data = Array.isArray(logData) ? logData : Array.prototype.slice.call(arguments);
  return util.format.apply(util, wrapErrorsWithInspect(data));
}

which accesses util.format https://github.com/nodejs/node/blob/master/lib/util.js#L48. This is from 5.6.0 but this line is the same for 4.3.0, basically, inspect(x) is called (x is the Mongoose Document).

Next call inside inspect: https://github.com/nodejs/node/blob/master/lib/util.js#L109 is formatValue, again, this is the same for both node versions.

Inside formatValue https://github.com/nodejs/node/blob/master/lib/util.js#L354 this happens:

var promiseInternals = inspectPromise(value);

https://github.com/nodejs/node/blob/master/lib/util.js#L199

which calls ensureDebugIsInitialized https://github.com/nodejs/node/blob/master/lib/util.js#L191

which leads to https://github.com/nodejs/node/blob/master/lib/vm.js#L38 where the whole thing explodes when in

exports.runInDebugContext = function(code) {
  return binding.runInDebugContext(code);
};

the native code binding.runInDebugContext(code); is called with "Debug".

node --version
v4.3.0

Edit
This issue happens only when node is started with --debug.

@mscdex
Copy link
Contributor

mscdex commented Feb 13, 2016

This issue should be fixed in the upcoming v4.3.1 LTS release.

FWIW you can also test right now with rc2 if you want: https://nodejs.org/download/rc/v4.3.1-rc.2/

@mscdex mscdex added the util Issues and PRs related to the built-in util module. label Feb 13, 2016
@akoskm
Copy link
Author

akoskm commented Feb 13, 2016

Thanks for the quick response! When we can expect the 4.3.1 release, is there a roadmap for the LTS versions?

@mscdex
Copy link
Contributor

mscdex commented Feb 13, 2016

Right now it looks like the plan is to release on Tuesday.

@evanlucas
Copy link
Contributor

Closing as v4.3.1 has been released. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
util Issues and PRs related to the built-in util module.
Projects
None yet
Development

No branches or pull requests

3 participants