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

Hitting ^D in a pause causes endless printing of 'exit' #8

Closed
aidanhs opened this issue Apr 20, 2014 · 8 comments · Fixed by #18
Closed

Hitting ^D in a pause causes endless printing of 'exit' #8

aidanhs opened this issue Apr 20, 2014 · 8 comments · Fixed by #18

Comments

@aidanhs
Copy link
Collaborator

aidanhs commented Apr 20, 2014

Keep on making this mistake and it locks up my ssh sessions, which is a pain.

@aidanhs aidanhs changed the title Hitting ^D in a pause point causes endless printing of 'exit' Hitting ^D in a pause causes endless printing of 'exit' Apr 20, 2014
@ianmiell
Copy link
Owner

I'm reminded of an old Tommy Cooper joke.

@unwitting
Copy link

"Doctor, I can't pronounce my F's, T's and H's."
"Well, you can't say fairer than that."

Probably a different one.

@ianmiell
Copy link
Owner

Interesting - am investigating a bug in a build which happens only on someone's machine here, and get endless printing of ^C
It doesn't happen for me, which implies something's changed in docker - which version are you running, and can you build an appserv on it?

repro on:
Docker version 0.10.0, build dc9c28f

Doesn't happen on:
Docker version 0.8.1, build a1598d1

@aidanhs
Copy link
Collaborator Author

aidanhs commented May 7, 2014

So, I got this (when playing with mounting in an unprivileged container and therefore getting a pause point when it fails) and had a thought about debugging.
Doing ps aux | grep docker (in another terminal...) shows that my docker client process is defunct, i.e. it's no longer running, it just needs python to read the exit code.
Sending SIGINT to the actual python process (which is consuming a fair chunk of CPU) reveals this:

[...]
exit
exit
Traceback (most recent call last):
  File "../../shutit_main.py", line 443, in <module>
    shutit_main()
  File "../../shutit_main.py", line 420, in shutit_main
    if not errs: errs = check_ready(config_dict, shutit_map)
  File "../../shutit_main.py", line 299, in check_ready
    if not m.check_ready(config_dict):
  File "./mysql.py", line 31, in check_ready
    util.send_and_expect(container_child,'mkdir /a',config_dict['expect_prompts']['base_prompt'])
  File "/home/aidanhs/Desktop/openbet/docker/shutit/util.py", line 134, in send_and_expect
    pause_point(child,msg + '\n\nPause point on exit_code != 0. CTRL-C to quit',force=True)
  File "/home/aidanhs/Desktop/openbet/docker/shutit/util.py", line 543, in pause_point
    child.interact()
  File "/home/aidanhs/Desktop/openbet/docker/shutit/local/lib/python2.7/site-packages/pexpect/__init__.py", line 1617, in interact
    self.__interact_copy(escape_character, input_filter, output_filter)
  File "/home/aidanhs/Desktop/openbet/docker/shutit/local/lib/python2.7/site-packages/pexpect/__init__.py", line 1645, in __interact_copy
    data = self.__interact_read(self.child_fd)
KeyboardInterrupt

So is something happening inside pexpect?
@ianmiell do you use the apt-get version of pexpect, rather than one from pip?

@zwischenzugs
Copy link
Contributor

Yes. I can only use apt-get, not pip.

On Wed, May 7, 2014 at 8:33 PM, aidanhs notifications@github.com wrote:

So, I got this (when playing with mounting in an unprivileged container
and therefore getting a pause point when it fails) and had a thought about
debugging.
Doing ps aux | grep docker (in another terminal...) shows that my docker
client process is defunct, i.e. it's no longer running, it just needs
python to read the exit code.
Sending SIGINT to the actual python process (which is consuming a fair
chunk of CPU) reveals this:

[...]
exit
exit
Traceback (most recent call last):
File "../../shutit_main.py", line 443, in
shutit_main()
File "../../shutit_main.py", line 420, in shutit_main
if not errs: errs = check_ready(config_dict, shutit_map)
File "../../shutit_main.py", line 299, in check_ready
if not m.check_ready(config_dict):
File "./mysql.py", line 31, in check_ready
util.send_and_expect(container_child,'mkdir /a',config_dict['expect_prompts']['base_prompt'])
File "/home/aidanhs/Desktop/openbet/docker/shutit/util.py", line 134, in send_and_expect
pause_point(child,msg + '\n\nPause point on exit_code != 0. CTRL-C to quit',force=True)
File "/home/aidanhs/Desktop/openbet/docker/shutit/util.py", line 543, in pause_point
child.interact()
File "/home/aidanhs/Desktop/openbet/docker/shutit/local/lib/python2.7/site-packages/pexpect/init.py", line 1617, in interact
self.interact_copy(escape_character, input_filter, output_filter)
File "/home/aidanhs/Desktop/openbet/docker/shutit/local/lib/python2.7/site-packages/pexpect/__init
.py", line 1645, in __interact_copy
data = self.__interact_read(self.child_fd)
KeyboardInterrupt

So is something happening inside pexpect?
@ianmiell https://github.com/ianmiell do you use the apt-get version of
pexpect, rather than one from pip?


Reply to this email directly or view it on GitHubhttps://github.com//issues/8#issuecomment-42472661
.

@zwischenzugs
Copy link
Contributor

imiell@lp01728:$ locate pexpect | grep init
imiell@lp01728:
$

Pexpect Copyright (c) 2008 Noah Spurrier
http://pexpect.sourceforge.net/

$Id: pexpect.py 507 2007-12-27 02:40:52Z noah $

My money would be on some kind of pexpect oddness then.

On Wed, May 7, 2014 at 8:35 PM, Ian Miell ian.miell@gmail.com wrote:

Yes. I can only use apt-get, not pip.

On Wed, May 7, 2014 at 8:33 PM, aidanhs notifications@github.com wrote:

So, I got this (when playing with mounting in an unprivileged container
and therefore getting a pause point when it fails) and had a thought about
debugging.
Doing ps aux | grep docker (in another terminal...) shows that my docker
client process is defunct, i.e. it's no longer running, it just needs
python to read the exit code.
Sending SIGINT to the actual python process (which is consuming a fair
chunk of CPU) reveals this:

[...]
exit
exit
Traceback (most recent call last):
File "../../shutit_main.py", line 443, in
shutit_main()
File "../../shutit_main.py", line 420, in shutit_main
if not errs: errs = check_ready(config_dict, shutit_map)
File "../../shutit_main.py", line 299, in check_ready
if not m.check_ready(config_dict):
File "./mysql.py", line 31, in check_ready
util.send_and_expect(container_child,'mkdir /a',config_dict['expect_prompts']['base_prompt'])
File "/home/aidanhs/Desktop/openbet/docker/shutit/util.py", line 134, in send_and_expect
pause_point(child,msg + '\n\nPause point on exit_code != 0. CTRL-C to quit',force=True)
File "/home/aidanhs/Desktop/openbet/docker/shutit/util.py", line 543, in pause_point
child.interact()
File "/home/aidanhs/Desktop/openbet/docker/shutit/local/lib/python2.7/site-packages/pexpect/init.py", line 1617, in interact
self.interact_copy(escape_character, input_filter, output_filter)
File "/home/aidanhs/Desktop/openbet/docker/shutit/local/lib/python2.7/site-packages/pexpect/__init
.py", line 1645, in __interact_copy
data = self.__interact_read(self.child_fd)
KeyboardInterrupt

So is something happening inside pexpect?
@ianmiell https://github.com/ianmiell do you use the apt-get version
of pexpect, rather than one from pip?


Reply to this email directly or view it on GitHubhttps://github.com//issues/8#issuecomment-42472661
.

@aidanhs
Copy link
Collaborator Author

aidanhs commented May 8, 2014

Bingo. The below code reproduces it reliably - just hit ctrl+D

import fdpexpect
import pty
import os
import sys

def proc_start(cmd_list):
        (child_pid, fd) = pty.fork()
        if child_pid == 0:
                # The first item of the list in the second argument is the name
                # of the new program
                try:
                        os.execvp(cmd_list[0], cmd_list)
                except OSError:
                        print "Failed to exec"
                        sys.exit(1)
        else:
                return fd

fd = proc_start(['/bin/bash'])
c = fdpexpect.fdspawn(fd)
c.interact()

@aidanhs
Copy link
Collaborator Author

aidanhs commented May 8, 2014

Raised in pexpect/pexpect#49

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

Successfully merging a pull request may close this issue.

4 participants