DarthSim / overmind

Process manager for Procfile-based applications and tmux
MIT License
2.84k stars 79 forks source link

Better way to deal with unexpected termination #50

Closed bhrutledge closed 3 years ago

bhrutledge commented 5 years ago

First, I love Overmind. Thank you for all the work!

This is a small issue, maybe solved by documentation. Most of the time, I exit overmind start via Ctrl-C (i.e., SIGINT). However, sometimes I'll inadvertently close the terminal. This leaves the processes running in a tmux session, and an orphan .overmind.sock. So, the next time I run overmind start, I get things like:

$ overmind start
overmind: it looks like Overmind is already running. If it's not, remove .overmind.sock and try again

$ pgrep -fl overmind
39965 tmux -CC ...
39966 /bin/sh /var/folders/m3/...
39967 /bin/sh /var/folders/m3/...

To recover from this, I run:

$ pkill -fl overmind; rm -f .overmind.sock 

It'd be nice if I could reattach to the running session, and/or clean it up with an Overmind command.

marckohlbrugge commented 4 years ago

I run into this all the time Here's what it looks like:

% overmind start
system | Tmux socket name: overmind-foobar-md7CP2HbTfJJglZ105B-cO
system | Tmux session ID: foobar
system | Listening at ./.overmind.sock
overmind: it looks like Overmind is already running. If it's not, remove ./.overmind.sock and try again

I figure it's already running in one of my tabs, so I do:

% overmind restart
overmind: dial unix ./.overmind.sock: connect: connection refused

Oh, looks like it's not running after all. Must be a stale .sock file.

% rm .overmind.sock
% overmind start

It gets a bit repetitive doing this over and over again.

Is there a way to have overmind start check if it's indeed still active and it not delete any stale sock files?

DarthSim commented 4 years ago

I hope, #86 fixes this. I honestly don't know a better way to handle this.

bhrutledge commented 3 years ago

This fixed it for me in v2.2.0. Thanks!