Sorry, something went wrong.
There was a problem hiding this comment.
Thanks! This is a good catch! Notice in general this problem is the reason --blocking exists as its impossible to fix this properly unfortunately. But this is a good fix
Sorry, something went wrong.
|
Thanks @maurycy for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15. |
Sorry, something went wrong.
|
GH-151459 is a backport of this pull request to the 3.15 branch. |
Sorry, something went wrong.
The issue is caused by memory walks with cache_frames=True when there's a cache miss.
If I understand the whole machniery correctly.
Basically, we don't copy chunks in cache mode:
cpython/Modules/_remote_debugging/threads.c
Lines 506 to 512 in f4f1020
So there are never any chunks in the cache mode, not a problem with full cache hits:
cpython/Modules/_remote_debugging/frames.c
Lines 328 to 351 in f4f1020
But when there's no cache hit:
cpython/Modules/_remote_debugging/frames.c
Lines 578 to 585 in f4f1020
it falls back to many memory reads:
cpython/Modules/_remote_debugging/frames.c
Line 315 in f4f1020
cpython/Modules/_remote_debugging/frames.c
Lines 236 to 242 in f4f1020
which isn't very atomic... the target mutates between reads and we're lost.
That's definitely the cause. Is there a cleaner fix ?
One side-note - let's not tighten the validation yet?
Generally, it's a statistical profiler so we should have some statistical tests for correctness, too.
Proof
Reusing
from #151424 we get
The impossible rate went to just 0,20%.