mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Assign the Fiber to self.fiber.
Doing so reveals a deadlock in the stop code (which causes self-test to fail, yay). Fix it by trying harder to not stop the (all or app) runner until after the app runner has processed the "hey you should stop" return false from onRunEnd.
This commit is contained in:
@@ -242,8 +242,11 @@ exports.run = function (appDir, options) {
|
||||
result.outcome === "wrong-release" ||
|
||||
(result.outcome === "terminated" &&
|
||||
result.signal === undefined && result.code === undefined)) {
|
||||
runner.stop();
|
||||
fut.isResolved() || fut['return'](result);
|
||||
// Allow run() to continue (and call runner.stop()) only once the
|
||||
// AppRunner has processed our "return false"; otherwise we deadlock.
|
||||
process.nextTick(function () {
|
||||
fut.isResolved() || fut['return'](result);
|
||||
});
|
||||
return false; // stop restarting
|
||||
}
|
||||
runner.regenerateAppPort();
|
||||
|
||||
@@ -266,11 +266,9 @@ _.extend(AppProcess.prototype, {
|
||||
// mongoUrl, oplogUrl, buildOptions, rootUrl, settingsFile, program,
|
||||
// proxy
|
||||
//
|
||||
// To use, construct an instance of AppRunner, and then call start()
|
||||
// to start it running. Call stop() at any time to shut it down and
|
||||
// clean it up. You should call stop() to clean up even if you return
|
||||
// false from onRunEnd(); this stops the restarting but doesn't
|
||||
// destroy the AppRunner instance.
|
||||
// To use, construct an instance of AppRunner, and then call start() to start it
|
||||
// running. To stop it, either return false from onRunEnd, or call stop(). (But
|
||||
// don't call stop() from inside onRunEnd: that causes a deadlock.)
|
||||
//
|
||||
// The 'result' argument to onRunEnd is an object with keys:
|
||||
//
|
||||
@@ -338,7 +336,8 @@ _.extend(AppRunner.prototype, {
|
||||
self.startFuture = new Future;
|
||||
self.fiber = new Fiber(function () {
|
||||
self._fiber();
|
||||
}).run();
|
||||
});
|
||||
self.fiber.run();
|
||||
self.startFuture.wait();
|
||||
self.startFuture = null;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user