Skip to content
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

Detached docker services exit; Implement an auto-restart upon exit #1

Open
3 tasks
Ryanmtate opened this issue Sep 23, 2017 · 2 comments
Open
3 tasks
Assignees

Comments

@Ryanmtate
Copy link
Member

Likely a service error (potentially a socket hangup) is causing a docker service to exit after long periods of time in detached mode. A few things can be done to ensure the service can recover

  • Use docker stacks to configure auto restart when a docker container process exits or errors (this is most preferred)
  • Current services are run using node.js; Consider using a PM2 process/daemon to restart failed services.
  • Cleanup dead sockets; After a socket server fails, the socket path is still listening, but cannot be re-attached to (i.e. will receive an EADDRINUSE -- error address in use ). To avoid this on a recover, automatically try to reconnect to the socket if the path is in use, but delete the path programmatically before rebooting.

Service exits could also be due to terminal crashes on my local machine; so I am monitoring this issue. However, the above changes should be critical fixes to known bugs.

@Ryanmtate
Copy link
Member Author

This is likely an unhandled error.

@Ryanmtate
Copy link
Member Author

When possible, try to catch the unhandled error (uncaughtException).

Add to all processes that make socket connections; Automatically re-try to connect to broken connections.

process.on('uncaughtException', function (err) {
  console.error(err.stack);
  // attempt reconnect here if error is EPIPE, ECONNRESET, etc
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant