'why does a node.js process suddenly die on osx with no explanation in any log file?
90% of the time I always get a stack trace. But sometimes the process just quits and I have no idea why. Anyway to print the stack trace always? Or find more information in dmesg or something?
Solution 1:[1]
okay finally found a way to find the error:
node --trace app.js
it outputs every function call and I can see the stacktrace right before it exits with:
startup.processKillAndExit.process.exit
And my stacktrace points to:
redis.get('bar', (err, data) -> JSON.parse(value).foo)
JSON.parse(value) comes back null so .foo throws:
[TypeError: Cannot read property 'foo' of null]
and for some reason the TypeError inside a redis callback is swallowed and causes node to exit without printing the error.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | surj |
