mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Exit more cleanly on unhandled errors, and handle errors writing to Clients.
Summary: - Node has a strong recommendation to assume bad state and exit promptly on unhandled exceptions and rejections. We follow it, and only make an effort to clean up before exiting, and to log the error in a more standard way. - The only case seen in recent month of an unhandled rejection was for attempting to write overly large JSON to a Client websocket. Ensure that's handled, and add a test case that artificially reproduces this scenario. Test Plan: Added a test case for failing write to Client, and a test case that unhandled errors indeed kill the server but with an attempt at cleanup. Reviewers: georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D4124
This commit is contained in:
@@ -87,6 +87,10 @@ export class TestServerMerged extends EventEmitter implements IMochaServer {
|
||||
// immediately. It is simplest to use a diffent socket each time
|
||||
// we restart.
|
||||
const testingSocket = path.join(this.testDir, `testing-${this._starts}.socket`);
|
||||
if (testingSocket.length >= 108) {
|
||||
// Unix socket paths typically can't be longer than this. Who knew. Make the error obvious.
|
||||
throw new Error(`Path of testingSocket too long: ${testingSocket.length} (${testingSocket})`);
|
||||
}
|
||||
|
||||
const stubCmd = '_build/stubs/app/server/server';
|
||||
const isCore = await fse.pathExists(stubCmd + '.js');
|
||||
|
||||
Reference in New Issue
Block a user