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

Potential bug on install requirements mutation during dependency resolution #11019

Open
1 task done
atugushev opened this issue Apr 8, 2022 · 8 comments
Open
1 task done
Labels
state: needs reproducer Need to reproduce issue type: bug A confirmed bug or unintended behavior

Comments

@atugushev
Copy link
Contributor

atugushev commented Apr 8, 2022

Description

While working on the new resolver support in pip-tools (jazzband/pip-tools#1539) I ran into an issue with failing tests against pip's main branch. Using git bisect I've tracked down a bad commit 0c28452 which was introduced in #10962.

The main issue with the following line:

template.req.specifier = specifier

... where template essentially is ireqs[0]:

See also discussion on the commit.

Expected behavior

I've prepared a temporary fix where template is deep copied from ireqs[0] (see #11018) which makes pip-tools' tests pass. Any ideas on how to avoid ireqs mutation which might lead to potential bugs?

pip version

22.1.dev0

Python version

3.8

OS

macOS

How to Reproduce

Unfortunately, I haven't found yet simple reproducer other than pip-tools' tests:

  1. git clone https://github.com/atugushev/pip-tools@new-resolver
  2. cd pip-tools
  3. tox -e py38-pipmain -- -k 'not network'

Output

https://github.com/jazzband/pip-tools/runs/5872141303?check_suite_focus=true

Code of Conduct

@atugushev atugushev added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Apr 8, 2022
@pradyunsg pradyunsg added this to the 22.1 milestone Apr 8, 2022
@pradyunsg pradyunsg removed the S: needs triage Issues/PRs that need to be triaged label Apr 8, 2022
@pradyunsg pradyunsg added the !release blocker Hold a release until this is resolved label Apr 23, 2022
@pradyunsg
Copy link
Member

I'm marking this as a release blocker, or at least, as something we'd want to see tested as part of a beta release before a proper release.

@pradyunsg
Copy link
Member

OK, I'm leaning toward reverting #10962 at the moment, since we don't seem to have a clear understanding of what the right fix for this is (outside of doing a deepcopy, which makes me concerned about the memory usage of long-running resolution runs).

@pradyunsg
Copy link
Member

Beyond that, this is in a pip beta release now -- so... if folks wanna try this out and let us know if things break in weird ways, please feel welcome to!

@pradyunsg
Copy link
Member

@atugushev Could you provide a reproducer for the issue?

@pradyunsg
Copy link
Member

I've just merged #11085, which drops this concern for now and unblocks this release.

@pradyunsg pradyunsg removed the !release blocker Hold a release until this is resolved label May 9, 2022
@pradyunsg pradyunsg reopened this May 9, 2022
@pradyunsg pradyunsg added the state: needs reproducer Need to reproduce issue label May 9, 2022
@pradyunsg
Copy link
Member

Leaving this open actually, because this still needs a reproducer.

@sleiner
Copy link

sleiner commented May 24, 2023

@pradyunsg

we don't seem to have a clear understanding of what the right fix for this is (outside of doing a deepcopy, which makes me concerned about the memory usage of long-running resolution runs)

If we must not modify ireqs, but to modify template in the special case for having in #9243, we could only copy template in the case where we actually perform those modifications (either deeply or even only shallow + the modified parts). As far as I see, this would not impact memory usage for the cases that work currently but make the cases of #9243 work. What do you think?

@uranusjr
Copy link
Member

uranusjr commented May 25, 2023

That’s already tried (see linked unmerged PR above) and did not seem to fix the issue, leading to suspicions that the pip-tools bug is not actually related to requirement mutation. If you want to address the mutation issue specifically for a different reason, feel free to open a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: needs reproducer Need to reproduce issue type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests

4 participants