Skip to content

Commit

Permalink
Give a more specific error message on disk full
Browse files Browse the repository at this point in the history
Fixes #2378.

Note that this error is detected by reading stdout, and we don't
actually want to buffer all of stdout in memory (it grows pretty fast).
  • Loading branch information
glasser committed Feb 6, 2015
1 parent 07b6a22 commit d02bfe1
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions tools/run-mongo.js
Expand Up @@ -381,7 +381,7 @@ var launchMongo = function (options) {
handle.stop();

// Invoke the outer onExit callback.
onExit(code, signal, stderrOutput);
onExit(code, signal, stderrOutput, detectedErrors);
});
proc.on('exit', procExitHandler);

Expand All @@ -400,6 +400,7 @@ var launchMongo = function (options) {
}
};

var detectedErrors = {};
var stdoutOnData = fiberHelpers.bindEnvironment(function (data) {
// note: don't use "else ifs" in this, because 'data' can have multiple
// lines
Expand All @@ -417,6 +418,10 @@ var launchMongo = function (options) {
replSetReady = true;
maybeReadyToTalk();
}

if (/Insufficient free space/.test(data)) {
detectedErrors.freeSpace = true;
}
});
proc.stdout.setEncoding('utf8');
proc.stdout.on('data', stdoutOnData);
Expand Down Expand Up @@ -669,7 +674,7 @@ _.extend(MRp, {
}
},

_exited: function (code, signal, stderr) {
_exited: function (code, signal, stderr, detectedErrors) {
var self = this;

self.handle = null;
Expand Down Expand Up @@ -725,8 +730,13 @@ _.extend(MRp, {
var explanation = mongoExitCodes.Codes[code];
var message = "Can't start Mongo server.";

if (explanation)
if (explanation && explanation.symbol === 'EXIT_UNCAUGHT' &&
detectedErrors.freeSpace) {
message += "\n\n" +
"Looks like you are out of free disk space under .meteor/local.";
} else if (explanation) {
message += "\n" + explanation.longText;
}

if (explanation === mongoExitCodes.EXIT_NET_ERROR) {
message += "\n\n" +
Expand Down

0 comments on commit d02bfe1

Please sign in to comment.