Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 743115 - sys-apps/portage: slot conflict triggered by missed update triggers excessive backtracking when there are many impossible versions to update to
Summary: sys-apps/portage: slot conflict triggered by missed update triggers excessive...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Dependencies (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 300071 739718
  Show dependency tree
 
Reported: 2020-09-17 07:49 UTC by Michał Górny
Modified: 2020-11-22 07:23 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Portage output (output.txt,132.62 KB, text/plain)
2020-09-17 07:49 UTC, Michał Górny
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-09-17 07:49:42 UTC
Created attachment 660978 [details]
Portage output

I have a bunch of packages installed in earlier versions due to python2.7 target deps.  Portage keeps throwing a lot of slot conflict spam at every @world upgrade due to them but so far was able to keep working (and installing old versions for these packages).  However, when I've unmasked new pypy3 version for testing and this involves subslot rebuild for some of these packages, Portage goes crazy and is unable to proceed.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-09-17 07:50:06 UTC
(this can be resolved by masking all the conflicting new versions but this isn't exactly user-friendly)
Comment 2 Zac Medico gentoo-dev 2020-09-17 08:10:46 UTC
(In reply to Michał Górny from comment #0)
> I have a bunch of packages installed in earlier versions due to python2.7
> target deps.

That triggers backtracking, and if there are enough missed updates then eventually you'll hit the backtracking limit. When that happens, we have a couple of options:

1) Use a larger --backtrack argument.
2) Improve the backtracking algorithm so that less backtracking is needed.
Comment 3 Zac Medico gentoo-dev 2020-09-17 16:23:18 UTC
A glaring problem with the current backtracking approach is that it only eliminates one package at a time. For example, consider these versions of setuptools which available:

dev-python/setuptools-50.3.0
dev-python/setuptools-50.2.0
dev-python/setuptools-50.1.0
dev-python/setuptools-49.6.0
dev-python/setuptools-46.4.0-r2
dev-python/setuptools-46.4.0-r1

When emerge encounters its first setuptools slot conflict, it will add dev-python/setuptools-50.3.0 to its runtime package mask, and then start backtracking. What we really want it to do is to add all of these versions to its runtime package mask at the same time:

dev-python/setuptools-50.3.0
dev-python/setuptools-50.2.0
dev-python/setuptools-50.1.0
dev-python/setuptools-49.6.0

If it does that, then it won't have to waste time backtracking in order to eliminate the other versions which will not satisfy the python_targets_python2_7 USE dependency.
Comment 4 Larry the Git Cow gentoo-dev 2020-09-19 20:28:29 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=302a93e5857ff56d43ee0b9dabee9f00d907a8ad

commit 302a93e5857ff56d43ee0b9dabee9f00d907a8ad
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2020-09-13 01:42:30 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2020-09-19 20:22:41 +0000

    Add unit test demonstrating excessive backtracking for bug 743115
    
    Due to excessive backtracking, this test case currently needs
    at least --backtrack=21 to succeed.
    
    Bug: https://bugs.gentoo.org/743115
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 .../resolver/test_slot_operator_missed_update.py   | 112 +++++++++++++++++++++
 1 file changed, 112 insertions(+)
Comment 6 Larry the Git Cow gentoo-dev 2020-09-21 05:39:17 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=f64310749f176f8921b72ce282b4294efe81c3f0

commit f64310749f176f8921b72ce282b4294efe81c3f0
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2020-09-19 21:32:41 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2020-09-20 22:27:32 +0000

    _slot_confict_backtrack: minimize conflict atoms (bug 743631)
    
    Prefer choices that minimize conflict atoms, so that choices
    which satisfy all parents are preferred. This reduces the
    minimum necessary backtrack tries from 21 to 7 for the unit
    test related to bug 743115.
    
    Bug: https://bugs.gentoo.org/743115
    Bug: https://bugs.gentoo.org/743631
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/_emerge/depgraph.py                                        | 6 ++++++
 lib/portage/tests/resolver/test_slot_operator_missed_update.py | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)
Comment 7 Larry the Git Cow gentoo-dev 2020-09-21 05:42:14 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=9afc5d5a808ca66173b1d803469cd44bc24e99be

commit 9afc5d5a808ca66173b1d803469cd44bc24e99be
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2020-09-19 23:18:16 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2020-09-20 22:59:06 +0000

    _slot_confict_backtrack: group similar missed updates (bug 743115)
    
    When a slot conflict occurs due to a missed update, and some other
    similar update(s) are available, add the similar update(s) to the
    runtime package mask for the same backtracking choice. This reduces
    minimum number of backtrack tries required to solve the test case
    for bug 743115 from 7 to 4, where the difference of 3 corresponds
    to the number of other similar setuptools updates available.
    
    Bug: https://bugs.gentoo.org/743115
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/_emerge/depgraph.py                            | 25 ++++++++++++++++++----
 lib/_emerge/resolver/backtracking.py               |  7 +++---
 .../resolver/test_slot_operator_missed_update.py   |  2 +-
 3 files changed, 26 insertions(+), 8 deletions(-)
Comment 8 Larry the Git Cow gentoo-dev 2020-09-21 05:59:41 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=862266358f01efa90c12d182d1f85a3014b80439

commit 862266358f01efa90c12d182d1f85a3014b80439
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2020-09-21 05:35:06 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2020-09-21 05:59:31 +0000

    sys-apps/portage: Bump to version 3.0.8
    
     #404157 emerge: --keep-going support pkg_pretend failures
     #644246 Add mercurial sync support
     #710432 emerge: Enable parallel-fetch during pkg_pretend
     #743115 emerge: Fix slot conflict backtracking to group similar
             missed updates into a single backtracking try
     #743631 emerge: Fix slot conflict backtracking to prefer
             choices that satisfy all dependencies
    
    Bug: https://bugs.gentoo.org/739718
    Bug: https://bugs.gentoo.org/404157
    Bug: https://bugs.gentoo.org/644246
    Bug: https://bugs.gentoo.org/710432
    Bug: https://bugs.gentoo.org/743115
    Bug: https://bugs.gentoo.org/743631
    Package-Manager: Portage-3.0.8, Repoman-3.0.1
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 sys-apps/portage/Manifest             |   1 +
 sys-apps/portage/portage-3.0.8.ebuild | 267 ++++++++++++++++++++++++++++++++++
 2 files changed, 268 insertions(+)