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

infinite loop after pip install on Android API 24 #5322

Closed
xdegaye opened this issue Apr 22, 2018 · 6 comments
Closed

infinite loop after pip install on Android API 24 #5322

xdegaye opened this issue Apr 22, 2018 · 6 comments
Labels
auto-locked Outdated issues that have been locked by automation project: vendored dependency Related to a vendored dependency type: bug A confirmed bug or unintended behavior

Comments

@xdegaye
Copy link

xdegaye commented Apr 22, 2018

  • Pip version: 9.0.1
  • Python version: 3.8 (current master branch)
  • Operating system: Android 7.0 (API 24)

Description:

After a successfull install of a first package (pygeodesy) pip never exits and must be interrupted with ^C.

What I've run:

$ python -m ensurepip --upgrade --default-pip
$ pip install pygeodesy
^CTraceback (most recent call last):
  File "/data/data/com.termux/files/usr/local/lib/python3.8/site-packages/pip/_vendor/lockfile/linklockfile.py", line 31, in acquire
    os.link(self.unique_name, self.lock_file)
PermissionError: [Errno 13] Permission denied: '/data/data/com.termux/files/home/.cache/pip/localhost-7f1b3a98.201375002993129885618981' -> '/data/data/com.termux/files/home/.cache/pip/selfcheck.json.lock'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/local/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/data/data/com.termux/files/usr/local/lib/python3.8/site-packages/pip/__init__.py", line 233, in main
    return command.main(cmd_args)
  File "/data/data/com.termux/files/usr/local/lib/python3.8/site-packages/pip/basecommand.py", line 252, in main
    pip_version_check(session)
  File "/data/data/com.termux/files/usr/local/lib/python3.8/site-packages/pip/utils/outdated.py", line 138, in pip_version_check
    state.save(pypi_version, current_time)
  File "/data/data/com.termux/files/usr/local/lib/python3.8/site-packages/pip/utils/outdated.py", line 71, in save
    with lockfile.LockFile(self.statefile_path):
  File "/data/data/com.termux/files/usr/local/lib/python3.8/site-packages/pip/_vendor/lockfile/__init__.py", line 197, in __enter__
    self.acquire()
  File "/data/data/com.termux/files/usr/local/lib/python3.8/site-packages/pip/_vendor/lockfile/linklockfile.py", line 50, in acquire
    time.sleep(timeout is not None and timeout / 10 or 0.1)
KeyboardInterrupt
@xdegaye
Copy link
Author

xdegaye commented Apr 22, 2018

On Android API 24 and more recent versions, hard links are not allowed by the SELinux policies set by Android except for privileged users (i.e. root), see https://bugs.python.org/issue28759.

LinkLockFile.acquire() in pip/_vendor/lockfile/linklockfile.py runs with timeout as None, hence the infinite loop.

@pradyunsg
Copy link
Member

Hi @xdegaye! Thanks for filing this issue. :)

I don't think pip directly supports either Python 3.8 (the in-development version) or Android.

That said, this issue stems from a vendored dependency (lockfile) and the issue should be fixed there. Note that we're looking into alternatives to lockfile (#4766), which would likely also fix this problem.

@pradyunsg pradyunsg added project: vendored dependency Related to a vendored dependency S: needs triage Issues/PRs that need to be triaged labels May 10, 2018
@xdegaye
Copy link
Author

xdegaye commented May 10, 2018

@pradyunsg

I don't think pip directly supports either Python 3.8 (the in-development version) or Android.

FWIW it is possible to install Python 3.6 on Android with termux on Android API 24 (i.e. Android 7.0 Nougat) and to install Python packages with pip.

@xdegaye
Copy link
Author

xdegaye commented Feb 8, 2019

@pradyunsg

That said, this issue stems from a vendored dependency (lockfile) and the issue should be fixed there

The LinkLockFile.acquire() method in linklockfile.py loops infinitely when the following conditions are met:

  • self.timeout is None
  • acquire() is not called with the timeout key word argument, or it is set to None
  • os.link() fails with PermissionError or any other permanent condition

The issue does stem from the implementation of this method.

@cjerdonek
Copy link
Member

cjerdonek commented Feb 8, 2019

It looks like that code should be letting PermissionErrors bubble up, which is similar to the issue with #6169.

@chrahunt
Copy link
Member

I have created #6954 to consolidate these issues, let's track it there.

@chrahunt chrahunt added type: bug A confirmed bug or unintended behavior and removed S: needs triage Issues/PRs that need to be triaged labels Aug 31, 2019
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Sep 30, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Sep 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation project: vendored dependency Related to a vendored dependency type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests

4 participants