martanne/abduco

OS X/iTerm 2: abduco requires keyboard input after process ends to quit, pegs a CPU

tomjakubowski opened this issue · 3 comments

Running master revision 586d751:

% abduco -v
abduco-0.5 © 2013-2015 Marc André Tanner

I create a new abduco session running an ephemeral process:

% abduco -c foo sh -c 'echo 'hello world''

The terminal goes blank, "hello world" is printed:

screen shot 2016-01-19 at 12 44 54 pm

At this point, abduco is using 99% CPU. If I press <RET> or something, then abduco quits. If I don't, then abduco survives even the closing of its terminal window and I have an annoying spinning process doing nothing but wasting battery life and cycles :-)

If I run:

% make debug
% ./abduco -n debug echo 'hello world' 2> server-log

The server-log file grows indefinitely at a rate of roughly ~3MB/s. The log file looks like this

read_all(255)
read_all(255)
server-read-pty:: CONTENT hello world

server pty died: 0
server-read-pty:: CONTENT
server-read-pty:: CONTENT
server-read-pty:: CONTENT
server-read-pty:: CONTENT
server-read-pty:: CONTENT
[...]

Where [...] means the previous line repeats. The abduco process also uses 99% CPU in this case.

If I attach to the session and hit <RET>, I see the following at the end of the server-log:

server-read-pty:: CONTENT
read_all(16)
read_all(1)
server-recv:: CONTENT
server-write-pty:: CONTENT
write_all(1)
FAILED
server-send:: EXIT len: 4
write_all(20)
read_all(16)
read_all(4)
server-recv:: EXIT len: 4

And the process exits.

Thanks for the detailed report! Did the latest commit improve things?

Yes, indeed it did. Thank you for the quick fix!