Reputation: 4084
My app.js has the following contents:
var express = require('express')
, http = require('http')
, path = require('path')
, redis = require('redis')
, client = redis.createClient();
var app = express();
app.configure(function(){
app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.cookieParser('your secret here'));
app.use(express.session());
app.use(app.router);
app.use(require('stylus').middleware(__dirname + '/public'));
app.use(express.static(path.join(__dirname, 'public')));
});
app.configure('development', function(){
app.use(express.errorHandler());
});
require('./routes')(app);
client.on("connect", function () {
console.log("Client on connect");
});
http.createServer(app).listen(app.get('port'), function(){
console.log("Express server listening on port " + app.get('port'));
});
All I'm attempting is to use the node_redis library to connect with a Redis instance. Both Node.js, and Redis are installed locally. One thing I'd like to point out is that I created, and attempting to run this project with Jetbrains' Webstorm (since I would like an IDE that provides me with some debugging). The string 'Client on connect' is logged to the console, but my app pretty much crashes every single time with 'Process finished with exit code 139'
. I tried running the app via the command line, and the app doesn't crash. The worst part is that there is no stack trace of any sort when the app fails to run in Webstorm. Does anyone have any clue on what the issue is or where I could find more information that is logged regarding this error code?
Also, just so that we're on the same page: My Redis server is up and running, and receiving a constant stream of data from another custom webapp. I was able to fire up redis-cli, and verify that Redis actually contains any data.
Upvotes: 4
Views: 3862
Reputation: 203484
If you're using a Unix-type OS, 139 means "128 + the signal number your Node process crashed on". So in your case, that signal was 11, which on most Unices means SIGSEGV. In other words: the Node process crashes on some sort of invalid memory reference.
In my experience, when you get these kinds of errors while starting processes from IDE's (or other apps), it usually means the IDE is passing some sort of environment which causes the crash. You could try and attach GDB to the running Node process (but before connecting to it, causing the crash) to find out what's causing it.
Another solution: if you can change the node executable that Webstorm will start, you could try to make a shell script which wraps Node and prints some debugging info. Something like this:
#!/bin/sh
echo "ENVIRONMENT: $ENV"
sleep 1
/path/to/actual/node "$@"
That would output the environment variables which are passed to the Node executable. From there, you could try and unset any variables which look suspicious:
unset STRANGE_VARIABLE
You place those in the script above, before starting the Node executable.
Upvotes: 3