AndreasMadsen / trace

Creates super long stack traces
https://trace.js.org
MIT License
194 stars 18 forks source link

Issue with Node 4 #15

Closed julien-f closed 8 years ago

julien-f commented 8 years ago

It works correctly with process.nextTick(), setImmediate(), setTimeout(), even errors originating from fs.readFile() but not with http.request().

require('trace')

var request = require('http').request

function main () {
  request({ hostname: '0.0.0.1' }, response => {
    response.pipe(process.stdout)
  })
}

main()
> node index.js
events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: connect EINVAL 0.0.0.1:80 - Local (0.0.0.0:0)
    at Object.exports._errnoException (util.js:837:11)
    at exports._exceptionWithHostPort (util.js:860:20)
    at connect (net.js:838:14)
    at net.js:934:9
    at doNTCallback0 (node.js:407:9)
    at process._tickCallback (node.js:336:13)
    at Function.Module.runMain (module.js:477:11)
    at startup (node.js:117:18)
    at node.js:951:3
    at fireErrorCallbacks (net.js:444:15)

As you can see, the stack trace does not reference my code :/

AndreasMadsen commented 8 years ago

Most likely it is caused by https://github.com/nodejs/node/issues/3241 - I will verify it later.

AndreasMadsen commented 8 years ago

It is your stack trace limit there is too short.

This is the full stack trace:


Error: connect EHOSTUNREACH 0.0.0.1:80 - Local (10.0.1.5:53093)
    at Object.exports._errnoException (util.js:874:11)
    at exports._exceptionWithHostPort (util.js:897:20)
    at connect (net.js:838:14)
    at net.js:934:9
    at doNTCallback0 (node.js:417:9)
    at process._tickCallback (node.js:346:13)
    at Function.Module.runMain (module.js:459:11)
    at startup (node.js:134:18)
    at node.js:961:3
    at fireErrorCallbacks (net.js:444:15)
    at Socket._destroy (net.js:480:3)
    at connect (net.js:839:10)
    at net.js:934:9
    at doNTCallback0 (node.js:417:9)
    at process._tickCallback (node.js:346:13)
    at Function.Module.runMain (module.js:459:11)
    at startup (node.js:134:18)
    at node.js:961:3
    at lookupAndConnect (net.js:932:13)
    at Socket.connect (net.js:901:5)
    at Agent.exports.connect.exports.createConnection (net.js:63:35)
    at Agent.createSocket (_http_agent.js:174:16)
    at Agent.addRequest (_http_agent.js:143:23)
    at new ClientRequest (_http_client.js:136:16)
    at exports.request (http.js:31:10)
    at main (/scripts/regression-http-bad-connect.js:6:3)
    at Object.<anonymous> (/scripts/regression-http-bad-connect.js:11:1) <-- here is your stuff
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:457:10)
    at startup (node.js:134:18)
    at node.js:961:3
julien-f commented 8 years ago

Yes, thank you!