-
Notifications
You must be signed in to change notification settings - Fork 25
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
test_conda_downgrade
and test_python2_update
exhibit mixed behavior of results
#317
test_conda_downgrade
and test_python2_update
exhibit mixed behavior of results
#317
Comments
We have been seeing this a couple times with some flakiness, where Python version is downgraded to 3.5 instead of 3.6.
Probably worth taking a look, specially because of the mixed behavior across platforms and channels (only fails on Linux + conda-forge; maybe due to different "pressures" in the packaging landscape over there). |
test_conda_downgrade
exhibits mixed behavior of results in Linux x conda-forge
Also observed in Windows x Python 3.8 x conda-forge, so not unique to Linux. |
test_conda_downgrade
exhibits mixed behavior of results in Linux x conda-forgetest_conda_downgrade
exhibits mixed behavior of results
Note that the failing assertions were skipped in #323, but we should still investigate and make this fully pass in a consistent way. |
I gave this a try today in #378 but it's not enough. I left the following bash loop running for a while: i=0
while pytest "tests/core/test_solve.py::test_conda_downgrade[libmamba]"; do
i=$((i+1));
echo ATTEMPT $i;
done It ran FOR A WHILE (pun very much intended) and, eventually, at ATTEMPT 137:
To be clear: it ran successfully for 136 attempts before failing. This is with #378 checked out and this
... this is going to be fun 😂 Where is the randomness coming from? |
Reproduced again after 107 attempts on 5f39175. |
With the following form (fixing the seed), you can reproduce in <20 attempts (better than ~150 before!): i=1
while PYTHONHASHSEED=0 CONDA_VERBOSITY=3 pytest "tests/core/test_solve.py::test_conda_downgrade[libmamba]" -vvvs 2>&1 | tee -a ../conda-libmamba-solver-src/logs.txt; do
i=$((i+1));
if [ $i -eq 200 ]; then break; fi;
echo ATTEMPT $i >> ../conda-libmamba-solver-src/logs.txt;
done This allowed me to iterate faster and try 933c0fb. With that change I haven't been able to reproduce in several rounds of 200 attempts. 🤷 I also observed in the logs that the average time spent on each test jumped from 16s (sorted) to ~50s (unsorted), because when unsorted the solver has to backtrack a lot. Even if they take longer, the solver eventually finds a solution... it's just that it can be a different one than the expected. IOW, the excess backtracking explains why sometimes it finds a Python 3.5 solution (or even 2.7), instead of the expected 3.6. Anyway, let's see what the PR is saying now. |
Well, #378 didn't work. We are seeing it in These are all passing and you can see identical libsolv logs: Number 14 failed: If we Note the scrollbar how the previous steps are identical (no diff colors). Zooming in with text: info libsolv Selecting variant [b] of (a) conda-4.3.30-py34h69bfab2_0 vs (b) conda-4.3.30-py35hf9359ed_0 (score: 1)
info libsolv Selecting variant [b] of (a) conda-4.3.30-py27h6ae6dc7_0 vs (b) conda-4.3.30-py36h5d9f9f4_0 (score: 1)
info libsolv Selecting variant [b] of (a) conda-4.3.30-py35hf9359ed_0 vs (b) conda-4.3.30-py36h5d9f9f4_0 (score: 64)
info libsolv Selecting variant [a] of (a) conda-4.3.30-py35hf9359ed_0 vs (b) conda-4.3.30-py27h6ae6dc7_0 (score: -1)
info libsolv Selecting variant [a] of (a) conda-4.3.30-py34h69bfab2_0 vs (b) conda-4.3.30-py27h6ae6dc7_0 (score: -1)
info libsolv creating a branch [data=223395]:
- info libsolv - conda-4.3.30-py36h5d9f9f4_0
info libsolv - conda-4.3.30-py35hf9359ed_0
+ info libsolv - conda-4.3.30-py34h69bfab2_0
info libsolv - conda-4.3.30-py27h6ae6dc7_0
- info libsolv installing conda-4.3.30-py36h5d9f9f4_0
+ info libsolv installing conda-4.3.30-py35hf9359ed_0
info libsolv installing conda-build-3.12.1-py37_0
info libsolv prune_to_best_version_conda 13 For some reason the py36 is not even listed in the 14th attempt logs, so libsolv ends up choosing the next one, py35. Additionally, if we compare some successful logs, sometimes we see that not all conda variants were considered in the aforementioned branch. However, as long as py36 is there, it'll be considered first and then the test passes. The problem arises when py36 is not in the branch. So far, I don't know exactly which strategy is followed to create a branch. The mamba docs provide some info, but I don't see anything there that points to things being dropped. My next guess: |
Doesn't seem to change much. I've also checked in the locally exported synthetic channels part of the What it seems to help is to reduce the amount of I traced the code back to the following chain of functions:
At this point, to continue debugging, I'm going to need to start recompiling libsolv and see where the missing conda records are. There seems to be some non-determinism in that part of the code. |
Ok forget about (4) above, I added some logging to a custom libsolv (yay!), and now we can pinpoint where the conda recs are being dropped:
IOW, the culprit is if (!s->obsoletes)
return 0; , where FOR_PROVIDES(p2, pp2, s->name)
{
s2 = pool->solvables + p2;
if (s2->repo == installed && s2->name == s->name && !(noupdate && MAPTST(noupdate, p - installed->start)))
return 1;
} Of those However, I realized this chunk of code was only added recently (libsolv 0.7.25, released in September), which matches the lifetime of this bug. This made it to conda-forge on Sep 29th, but it was never released in defaults (which is stuck with 0.7.24). That's why we only observed it the conda-forge CI. ANYWAY, if that's true (I am rerunning local tests) we can probably patch it out in the conda-forge feedstock. No changes needed in this repo. |
For completeness, here's a logfile with extended logging. This is the patched function I used: static int
replaces_installed_package(Pool *pool, Id p, Map *noupdate)
{
Repo *installed = pool->installed;
Solvable *s = pool->solvables + p, *s2;
Id p2, pp2;
Id obs, *obsp;
if (s->repo == installed && !(noupdate && MAPTST(noupdate, p - installed->start)))
{
POOL_DEBUG(SOLV_DEBUG_POLICY, " - 1148\n");
return 1;
}
FOR_PROVIDES(p2, pp2, s->name)
{
s2 = pool->solvables + p2;
if (s2->repo == installed) {
POOL_DEBUG(SOLV_DEBUG_POLICY, " - s2: %s\n", pool_solvid2str(pool, p2));
POOL_DEBUG(SOLV_DEBUG_POLICY, " - 1155\n");
if (s2->name == s->name) {
POOL_DEBUG(SOLV_DEBUG_POLICY, " - 1157\n");
if (!(noupdate && MAPTST(noupdate, p - installed->start))) {
POOL_DEBUG(SOLV_DEBUG_POLICY, " - 1159\n");
return 1;
}
}
}
}
if (!s->obsoletes)
{
POOL_DEBUG(SOLV_DEBUG_POLICY, " - 1167\n");
return 0;
}
obsp = s->repo->idarraydata + s->obsoletes;
while ((obs = *obsp++) != 0)
{
FOR_PROVIDES(p2, pp2, obs)
{
s2 = pool->solvables + p2;
if (s2->repo != pool->installed || (noupdate && MAPTST(noupdate, p - installed->start)))
continue;
if (!pool->obsoleteusesprovides && !pool_match_nevr(pool, s2, obs))
continue;
if (pool->obsoleteusescolors && !pool_colormatch(pool, s, s2))
continue;
POOL_DEBUG(SOLV_DEBUG_POLICY, " - 1177\n");
return 1;
}
}
POOL_DEBUG(SOLV_DEBUG_POLICY, " - 1181\n");
return 0;
} |
Hm, I found an example of a test running on defaults (hence libsolv 0.7.24, in principle exempt from the bug) that failed. However, every other example I could find was on conda-forge channels 🤔 I fetched all recent logs with these $ gh run list --json "databaseId,conclusion" -w tests --jq '.[] | select (.conclusion=="failure") | .databaseId' --limit 200 | xargs -L1 gh run view --log-failed >> failed_logs.txt
$ gh run list --json "databaseId,conclusion" -w "Upstream tests" --jq '.[] | select (.conclusion=="failure") | .databaseId' --limit 200 | xargs -L1 gh run view --log-failed >> failed_logs_upstream.txt And then searched for
So it looks like it's mostly conda-forge. Maybe some logs are missing, but the point stands: conda-forge errors are more prominent than in defaults (one one known case). I do see that the companion function to the one we want to patch out also does some In an abundance of caution I am going to run these experiments overnight:
If the above results in no reproducers, I'm inclined to let the feedstock patch that function out and close this issue. If it keeps happening after the release (either in defaults or in conda-forge patched), then we reopen and reassess. |
No reproducers. I think we are fine :) |
Well, I'm seeing some
🤷 It does use |
Sweet, another run where the same as above happens in all three Windows jobs. |
Adding to the overall flakiness, I've seen
This is happening again in |
test_conda_downgrade
exhibits mixed behavior of resultstest_conda_downgrade
and test_python2_update
exhibit mixed behavior of results
I've been seeing some more |
The Tests workflow failed on 2023-10-10 07:12 UTC
Full run: https://github.com/conda/conda-libmamba-solver/actions/runs/6465510729
(This post will be updated if another test fails, as long as this issue remains open.)
The text was updated successfully, but these errors were encountered: