mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
On MongoDB failures print 20 lines of stderr and print a special error if mongod failed to start due to incompatible version of glibc.
Catch stderr before 'exit' signal Try to give a good error message on outdated glibc/libstdc++. Simplify error reporting to two lines. Print only last 20 lines of stderr. Slightly better error message.
This commit is contained in:
@@ -172,7 +172,16 @@ exports.launch_mongo = function (app_dir, port, launch_callback, on_exit_callbac
|
||||
callback && callback(err);
|
||||
};
|
||||
|
||||
proc.on('exit', on_exit_callback);
|
||||
var stderrOutput = '';
|
||||
|
||||
proc.stderr.setEncoding('utf8');
|
||||
proc.stderr.on('data', function (data) {
|
||||
stderrOutput += data;
|
||||
});
|
||||
|
||||
proc.on('exit', function (code, signal) {
|
||||
on_exit_callback(code, signal, stderrOutput);
|
||||
});
|
||||
|
||||
proc.stdout.setEncoding('utf8');
|
||||
proc.stdout.on('data', function (data) {
|
||||
|
||||
13
tools/run.js
13
tools/run.js
@@ -628,11 +628,15 @@ exports.run = function (context, options) {
|
||||
}
|
||||
restartServer();
|
||||
},
|
||||
function (code, signal) { // On Mongo dead
|
||||
function (code, signal, stderr) { // On Mongo dead
|
||||
if (Status.shuttingDown) {
|
||||
return;
|
||||
}
|
||||
console.log("Unexpected mongo exit code " + code + ". Restarting.");
|
||||
|
||||
// Print only last 20 lines of stderr.
|
||||
stderr = stderr.split('\n').slice(-20).join('\n');
|
||||
|
||||
console.log(stderr + "Unexpected mongo exit code " + code + ". Restarting.\n");
|
||||
|
||||
// if mongo dies 3 times with less than 5 seconds between each,
|
||||
// declare it failed and die.
|
||||
@@ -645,6 +649,11 @@ exports.run = function (context, options) {
|
||||
if (explanation === mongoExitCodes.EXIT_NET_ERROR)
|
||||
console.log("\nCheck for other processes listening on port " + mongoPort +
|
||||
"\nor other meteors running in the same project.");
|
||||
if (!explanation && /GLIBC/i.test(stderr))
|
||||
console.log("\nLooks like you are trying to run Meteor on old Linux " +
|
||||
"distribution. Meteor only supports Linux with glibc " +
|
||||
"version 2.9 and above. Try upgrading your distribution " +
|
||||
"to the latest version.");
|
||||
process.exit(1);
|
||||
}
|
||||
if (mongoErrorTimer)
|
||||
|
||||
Reference in New Issue
Block a user