Skip to content

fix(valgrind): stop the libpython symlink warning from firing falsely - #594

Merged
not-matthias merged 1 commit into
mainfrom
cod-3977-runner-failed-to-symlink-libpython-warning-fires-falsely-in
Oct 23, 2026
Merged

not-matthias merged 1 commit into
mainfrom
cod-3977-runner-failed-to-symlink-libpython-warning-fires-falsely-in

Conversation

@not-matthias

@not-matthias not-matthias commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

The simulation setup runs venv_compat.sh to symlink libpython into a uv venv's lib directory. It warned Failed to symlink libpython in cases where nothing was wrong, and gave no reason at the default log level.

False positives:

  • python3 is a uv shim in ~/.local/bin and ~/.local/lib does not exist, so ln fails.
  • A non-venv python where ldd cannot find libpython, so the script links a file onto itself.

Real failure the warning should explain:

  • A cached .venv whose uv Python moved (e.g. a patch upgrade) has a dangling link. [ -e ] misses it and ln -s fails with "File exists". Valgrind then crashes.

Changes:

  • The script skips pythons that are not in a venv (no pyvenv.cfg), runs mkdir -p on the lib directory, and uses ln -sfn so stale links are replaced.
  • The warning stays at warn level. It now includes the script error and says flamegraphs may contain artifacts.
  • Tests run the script with a fake uv and ldd for the missing lib dir, the dangling link, and the non-venv case. All three fail on the old script.

Fixes COD-3977

@not-matthias
not-matthias force-pushed the cod-3977-runner-failed-to-symlink-libpython-warning-fires-falsely-in branch from 115a636 to 28e9c26 Compare October 22, 2026 14:39
@not-matthias
not-matthias marked this pull request as ready for review October 22, 2026 14:39
@greptile-apps

greptile-apps Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

The PR avoids false libpython warnings and repairs dangling links in Python virtual environments.

  • Valgrind setup keeps Python's shared library link usable in virtual environments.
  • Valgrind setup explains when a missing Python link may affect flamegraphs.

Reviews (2) · Last reviewed commit: "fix(valgrind): stop the libpython symlin..." · Reviewed by Greptile

Comment thread src/executor/valgrind/helpers/venv_compat.rs Outdated
The venv compat script treated any python it found as a venv. With a uv
shim in ~/.local/bin the link target directory did not exist, and for a
non-venv python it tried to link a file onto itself, so `ln` failed and
the runner warned although benchmarks ran fine.

The script now skips pythons that are not in a virtual environment,
creates the lib directory, and uses `ln -sfn` so a dangling link left by
a moved or upgraded uv python is replaced instead of failing with
"File exists".

The warning keeps its level but now includes the script error and says
that flamegraphs may contain artifacts.

Fixes COD-3977
@not-matthias
not-matthias force-pushed the cod-3977-runner-failed-to-symlink-libpython-warning-fires-falsely-in branch from 28e9c26 to d9612e3 Compare October 22, 2026 14:48
@not-matthias
not-matthias requested a review from lvaroqui October 22, 2026 14:49

@lvaroqui lvaroqui left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codspeed

codspeed Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

2 warnings, 1 note

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

⚠️ 8 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

ℹ️ 6 benchmarks have no flamegraph

The flamegraph wasn't generated: the symbols of the profiling trace could not be resolved, because no information about the language frames was collected.

See affected benchmarks

✅ 41 untouched benchmarks
⏩ 6 skipped benchmarks1


Comparing cod-3977-runner-failed-to-symlink-libpython-warning-fires-falsely-in (d9612e3) with main (db7de03)

Open in CodSpeed

Footnotes

  1. 6 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@not-matthias
not-matthias merged commit d9612e3 into main Oct 23, 2026
176 of 180 checks passed
@not-matthias
not-matthias deleted the cod-3977-runner-failed-to-symlink-libpython-warning-fires-falsely-in branch October 23, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants