martanne / abduco

abduco provides session management i.e. it allows programs to be run independently from its controlling terminal. That is programs can be detached - run in the background - and then later reattached. Together with dvtm it provides a simpler and cleaner alternative to tmux or screen.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Session still active after command terminated; connection refused

jangler opened this issue · comments

I was ssh'ed into an abduco session created with command "irssi", and irssi (or something in the ssh -> abduco -> irssi chain) stopped responding to input. I killed ssh, and when I reconnected I found that the abduco session was still "active" and displayed with an * in the session list, meaning that a client was considered to be still connected, even though no irssi process was running anymore. Trying to connect to the session resulted in the error message "attach session: Connection refused".

I haven't manually removed the socket yet, just in case there's still some debugging that could be done on it.

Sorry for the late answer. Is this reproducible (did it happen more than once)? Why did the irssi (or abduco server process) die? Killing the ssh client should only affect the abduco client process.

I tried it with ping and as far as I can see, it worked as expected:

$ ssh server
$ abduco -c foo ping google.com

Then locally, I killed the ssh client and reconnect.

$ ssh server
$ abduco
Active sessions (on host optimus7.inf.ethz.ch)
  Tue    2015-06-23 13:44:48    foo

As expected the session is still alive and no clients are connected i.e. no * is displayed in the listing above.

$ abduco -a foo
[ ping output omitted]
...
CTRL+C
abduco: foo: session terminated with exit status 0

No, I guess I've only seen it once. Still have that broken session hanging around, though. I'll see if I can figure out a way to reproduce this.

Still have that broken session hanging around, though.

That is the socket still exists? Could you check whether some process still has it opened (using e.g. lsof )?

I suspect that the abduco server process was killed with SIGKILL (in which case the socket will not be deleted because the signal can not be handled) instead of the default SIGTERM signal.

$ abduco -c sigterm ping google.com
$ killall abduco
$ abduco -c sigkill ping google.com
$ killall -9 abduco
$ abduco
Active sessions (on host debbook)
* Tue    2015-06-23 14:26:23    sigkill
$ abduco -a sigkill
attach-session: Connection refused

As you can see, the first session was properly cleaned up, however the latter seems analogous to your case.

At the moment I'm not sure how the cleanup procedure could be improved ...

Yeah, there's not much to do if you get SIGKILL. I checked using lsof and no process has the socket open. Any idea why abduco might have recieved SIGKILL?

I just had this happen to me now. I was running abduco in an ssh session to a vm, and the host machine rebooted. When I started the vm back up, I was stuck with a non-terminated but unattachable abduco session as described above. The socket is still present in the ~/.abduco directory.

Could you check whether the latest commits fix the issue? Such dead sockets should now be ignored. Only lightly tested though.

Adding @rpmohn since I know he is a heavy abduco user.

Works for me.

I haven't seen this, but I will pull the changes and test tomorrow.

I think this is fixed.

@rpmohn have you had time to test it in your AIX environment?

In general we have accumulated enough fixes and small improvements to warrant another release. Does current git HEAD work for you guys?

Working fine so far. I'll let you know if I have any problems.