You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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));
}
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.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
inutil
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 isformatValue
, again, this is the same for both node versions.Inside
formatValue
https://github.com/nodejs/node/blob/master/lib/util.js#L354 this happens:https://github.com/nodejs/node/blob/master/lib/util.js#L199
which calls
ensureDebugIsInitialized
https://github.com/nodejs/node/blob/master/lib/util.js#L191which leads to https://github.com/nodejs/node/blob/master/lib/vm.js#L38 where the whole thing explodes when in
the native code
binding.runInDebugContext(code);
is called with"Debug"
.Edit
This issue happens only when node is started with
--debug
.The text was updated successfully, but these errors were encountered: