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

If pipenv times out, it leaves processes running in the background #1203

Closed
tpoliaw opened this issue Dec 13, 2017 · 3 comments
Closed

If pipenv times out, it leaves processes running in the background #1203

tpoliaw opened this issue Dec 13, 2017 · 3 comments
Labels
help wanted Type: Bug 🐛 This issue is a bug.

Comments

@tpoliaw
Copy link

tpoliaw commented Dec 13, 2017

If an install times out (as in #65), three processes are left running locking files in the venv.
This issue isn't directly about the timeout, that's probably something to do with the network being slow here.

Describe your environment
  1. OS Type: RedHat 6.9
  2. Python version: $ python -V: 2.7.12
  3. Pipenv version: $ pipenv --version: 9.0.0
Expected result

Pipenv to either complete or to timeout and leave the machine in a clean state

Actual result

Pipenv times out, and leaves three processes running:

Steps to replicate
/tmp
❯ mkdir piptest
                                                                                                                                                                                                             
/tmp
❯ cd piptest 
                                                                                                                                                                                                             
/tmp/piptest
❯ echo $PIPENV_VENV_IN_PROJECT 
1
                                                                                                                                                                                                             
/tmp/piptest
❯ export PIPENV_TIMEOUT=10  # short enough to force the timeout
                                                                                                                                                                                                             
/tmp/piptest
❯ pipenv --three
Creating a virtualenv for this project…
Using /scratch/usr/bin/python3 to create virtualenv…
Traceback (most recent call last):
  File "/scratch/usr/lib/python3.6/site-packages/pipenv/vendor/pexpect/expect.py", line 96, in expect_loop
    return self.timeout()
  File "/scratch/usr/lib/python3.6/site-packages/pipenv/vendor/pexpect/expect.py", line 70, in timeout
    raise TIMEOUT(msg)
pexpect.exceptions.TIMEOUT: <pexpect.popen_spawn.PopenSpawn object at 0x7fd6f3236240>
searcher: searcher_re:
    0: EOF

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/scratch/usr/bin/pipenv", line 11, in <module>
    load_entry_point('pipenv==9.0.0', 'console_scripts', 'pipenv')()
  File "/scratch/usr/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/scratch/usr/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/scratch/usr/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1043, in invoke
    return Command.invoke(self, ctx)
  File "/scratch/usr/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/scratch/usr/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/scratch/usr/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/scratch/usr/lib/python3.6/site-packages/pipenv/cli.py", line 1721, in cli
    ensure_project(three=three, python=python, warn=True, site_packages=site_packages)
  File "/scratch/usr/lib/python3.6/site-packages/pipenv/cli.py", line 609, in ensure_project
    ensure_virtualenv(three=three, python=python, site_packages=site_packages)
  File "/scratch/usr/lib/python3.6/site-packages/pipenv/cli.py", line 570, in ensure_virtualenv
    do_create_virtualenv(python=python, site_packages=site_packages)
  File "/scratch/usr/lib/python3.6/site-packages/pipenv/cli.py", line 940, in do_create_virtualenv
    click.echo(crayons.blue(c.out), err=True)
  File "/scratch/usr/lib/python3.6/site-packages/pipenv/vendor/delegator.py", line 99, in out
    self.__out = self._pexpect_out
  File "/scratch/usr/lib/python3.6/site-packages/pipenv/vendor/delegator.py", line 87, in _pexpect_out
    result += self.subprocess.read()
  File "/scratch/usr/lib/python3.6/site-packages/pipenv/vendor/pexpect/spawnbase.py", line 427, in read
    self.expect(self.delimiter)
  File "/scratch/usr/lib/python3.6/site-packages/pipenv/vendor/pexpect/spawnbase.py", line 327, in expect
    timeout, searchwindowsize, async_)
  File "/scratch/usr/lib/python3.6/site-packages/pipenv/vendor/pexpect/spawnbase.py", line 355, in expect_list
    return exp.expect_loop(timeout)
  File "/scratch/usr/lib/python3.6/site-packages/pipenv/vendor/pexpect/expect.py", line 106, in expect_loop
    return self.timeout(e)
  File "/scratch/usr/lib/python3.6/site-packages/pipenv/vendor/pexpect/expect.py", line 70, in timeout
    raise TIMEOUT(msg)
pexpect.exceptions.TIMEOUT: <pexpect.popen_spawn.PopenSpawn object at 0x7fd6f3236240>
searcher: searcher_re:
    0: EOF
<pexpect.popen_spawn.PopenSpawn object at 0x7fd6f3236240>
searcher: searcher_re:
    0: EOF
                                                                                                                                                                                                             
/tmp/piptest 11s
❯ ps -ef |grep piptest
qan22331  8865     1  0 17:02 pts/0    00:00:00 /scratch/usr/bin/python /scratch/usr/bin/virtualenv /tmp/piptest/.venv --prompt=(piptest) -p /scratch/usr/bin/python3
qan22331  8867  8865  0 17:02 pts/0    00:00:00 /scratch/usr/bin/python3 /scratch/usr/lib/python2.7/site-packages/virtualenv.py /tmp/piptest/.venv --prompt=(piptest) -p /scratch/usr/bin/python3
qan22331  8869  8867  3 17:02 pts/0    00:00:01 /tmp/piptest/.venv/bin/python3 - setuptools pip wheel
qan22331  8936  5472  0 17:02 pts/0    00:00:00 grep --color=auto piptest

Trying the install again then fails with OSError: [Errno 26] Text file busy: '/tmp/piptest/.venv/bin/python3'

@tpoliaw
Copy link
Author

tpoliaw commented Dec 13, 2017

I'm starting to think this is caused by the same thing that is causing the timeout. Running the same commands on an Ubuntu machine, causes the timeout but not the hanging processes.

@rrzaripov
Copy link

Same behaviour with Windows 7 and Python 3.6.4.

@zero-jack
Copy link

zero-jack commented May 11, 2018

I suggest check the proxy setting or do not use proxy. I came into similar problem (EOF error or time out ) when using pipenv install. I think that it maybe happened because of proxy. So after no using proxy , it works.

My Env:

  • Ubuntu 17.10
  • Python 3.6.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Type: Bug 🐛 This issue is a bug.
Projects
None yet
Development

No branches or pull requests

4 participants