Skip to content

gh-154194: Do not fail the whole sample in Tachyon if we can degrade#154195

Open
maurycy wants to merge 2 commits into
python:mainfrom
maurycy:tachyon-degrade-gracefully
Open

gh-154194: Do not fail the whole sample in Tachyon if we can degrade#154195
maurycy wants to merge 2 commits into
python:mainfrom
maurycy:tachyon-degrade-gracefully

Conversation

@maurycy

@maurycy maurycy commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

As always, see #154194 for the context. Shortly: right now remote inspection fails the whole sample when it hits the limits (and we're really not sure what are the best limits) OR always when reading a part fails. This is too strict, wasteful and introduces scary bias, as observed in https://discuss.python.org/t/tachyon-97-error-rate/107619.

The PR introduces graceful degradation with the sentinels like <unreadable frame> (funcname), <unknown function> (funcname), <unknown file> (filename) and the (len=N) suffix if we hit the cap. Also, it introduces MAX_REMOTE_READ as a safety check, and attemps to better differentiate between transient failures in _Py_RemoteDebug_IsFatalReadError().

Importantly: degraded frames are never cached, while the truncated strigs are cached.

Fixes #154194

@maurycy
maurycy marked this pull request as ready for review July 19, 2026 20:17
@maurycy
maurycy requested a review from pablogsal as a code owner July 19, 2026 20:17
@maurycy

maurycy commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

I believe that the CI failures are caused by the fact that test_async_aware_running_sees_only_cpu_task does not terminate. It worked only because a torn read caused an exception. That's what inspired #153365 in the first place.

@pablogsal pablogsal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I still need more time but some nits


Py_ssize_t len = GET_MEMBER(Py_ssize_t, unicode_obj, unwinder->debug_offsets.unicode_object.length);
if (len < 0 || len > max_len) {
if (len < 0 || len > MAX_REMOTE_READ) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This rejects valid task names above 256 KiB instead of truncating them, so async sampling can still fail. We should cap read_len, not len, and test this boundary.

@@ -0,0 +1,3 @@
Fix the Tachyon dropping entire samples when non-fatal reads fail. Frames

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: the wording reads a bit off. Maybe Fix the sampling profiler dropping entire samples when a non-fatal read fails; frames now keep any readable metadata, and long funcnames, filenames and asyncio task names are truncated instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

_remote_debugging: Degrade gracefully reads instead of failing the whole read completely

2 participants