-
-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restart on EADDRINUSE #1890
Comments
@tshemsedinov It looks like the HTTP server is not returning this error via the error listener. Will it be ok to catch this error in this way in worker.js, or do we need to find a more elegant solution?: process.on('uncaughtException', function(err) {
if (err.code === 'EADDRINUSE') {
console.warn(`Address in use: ${options.host}:${port}, retry...`);
setTimeout(() => {
tryToStartCounter++;
if (tryToStartCounter > 3) process.kill(process.pid, 'SIGINT');
application.server = new metarhia.metacom.Server(application, options);
},options.timeouts.bind);
}
}); |
I was wrong, that wasn't the point. The problem was that a wsServer was created in addition to the httpServer, and the error occurred in the wsServer, so the httpServer error listener did not catch it. |
Refs: metarhia/impress#1890 PR-URL: #455 Co-authored-by: Timur Shemsedinov <[email protected]>
Fixed in #1908 and published 3.0.7 |
Describe the problem
Describe the solution
Port is in use by another server, so we can:
The text was updated successfully, but these errors were encountered: