28 Commits
Author SHA1 Message Date
Jelle ZijlstraandGitHub 6603289847 [3.14] gh-159739: Avoid destroying a remote unwinder cache twice (GH-159982) (#160084)
Leave cleanup of the code-object cache to the unwinder deallocator if
allocating the thread-local bytecode cache fails.

(cherry picked from commit b577a5403a)
2026-10-21 19:13:20 +00:00
2224ffff9c [3.14] gh-159620: Fix remote asyncio stacks stopping at async generators (GH-159623) (GH-159655)
Follow asynchronous-generator send/throw wrappers when unwinding suspended
and running asyncio tasks. Retry transient sampling errors in the existing
live-process stress test, matching main and 3.15.

(cherry picked from commit 2188f9b60a)

Co-authored-by: Timofei Ivankov <[email protected]>
Co-authored-by: Pablo Galindo Salgado <[email protected]>
2026-10-18 00:04:12 +00:00
4753622ec0 [3.14] gh-154194: Degrade frames instead of failing the sample (GH-154195) (#158833)
* gh-154194: Degrade unreadable frames on 3.14

(cherry picked from commit 7d25916b41)

Co-authored-by: Pablo Galindo Salgado <[email protected]>

* Preserve the stable ABI when creating fallback frame names

---------

Co-authored-by: Maurycy Pawłowski-Wieroński <[email protected]>
2026-10-05 10:04:44 +00:00
f660816008 [3.14] gh-153364: Make frame, coroutine, and task-waiter chain walks iterative and bounded (GH-153365) (#158814)
gh-153364: Make frame, coroutine, and task-waiter chain walks iterative and bounded (#153365)

* let me declare single limit

* use our new limit in process_frame_chain()

* add it in parse_async_frame_chain()

* parse_coro_chain()

* NEWS

* async in the message?

* test

* no race

* process_task_awaited_by

* process_task_awaited_by limit test

* NEWS

* MAX_TASK_WAITER_CHAIN_DEPTH

* TASK_WAITER_CHAIN_DEPTH in test

* TASK_WAITER_CHAIN_DEPTH 256

* prevent the drift with the comment

* better naming, better style

* MAX_TASK_WAITER_CHAIN_DEPTH comment

* task-waiter iterative bfs walk

* iterative coro-walk

* nicer news

* 1 << 14

* comment

* unused read_Py_ssize_t

* fix tombstones

* simplify

* correct msg

* better test

* news for tombstones

* left-over from when testing buggy version

* redundant new line

(cherry picked from commit e0861c6ae7)

Co-authored-by: Maurycy Pawłowski-Wieroński <[email protected]>
2026-10-05 00:37:18 +00:00
0a905eb8f1 [3.14] gh-157660: Fix stale TLBC caches in _remote_debugging (GH-157732) (#158007)
* gh-157660: Fix stale TLBC caches in _remote_debugging

`profiling.sampling` reporting errors or incorrect line numbers in free-threaded
builds when a thread-local bytecode array grows or gains entries after being cached.

* gh-157660: Retry transient sampling races in TLBC tests

---------

Co-authored-by: Pablo Galindo Salgado <[email protected]>
2026-09-27 20:14:43 +00:00
Timofei IvankovandGitHub 04b7fff7d6 [3.14] gh-157788: Fix python -m asyncio ps failing on long task names (#157843)
gh-157788: Fix python -m asyncio ps failing on long task names
2026-09-21 16:22:08 +05:30
Pablo Galindo SalgadoandGitHub 04735deeb2 [3.14] gh-149619: Harden _remote_debugging error paths (GH-150349) (#154844)
(cherry picked from commit a5be25d3bd)
2026-07-28 23:46:43 +01:00
AN LongandGitHub e01a038972 [3.14] gh-149931: Fix memory leaks on failed realloc (#150476)
(cherry picked from commit ec23ec6870)
2026-05-26 13:31:22 +00:00
Pablo Galindo SalgadoandGitHub 316f6265b7 [3.14] gh-148178: Validate remote debug offset tables on load (GH-148187) (#148577)
Treat the debug offset tables read from a target process as untrusted input
and validate them before the unwinder uses any reported sizes or offsets.

Add a shared validator in debug_offsets_validation.h and run it once when
_Py_DebugOffsets is loaded and once when AsyncioDebug is loaded. The checks
cover section sizes used for fixed local buffers and every offset that is
later dereferenced against a local buffer or local object view. This keeps
the bounds checks out of the sampling hot path while rejecting malformed
tables up front.
(cherry picked from commit 289fd2c97a)
2026-05-04 22:43:43 +01:00
sunmy2019andGitHub b406d85603 [3.14] gh-146615: Fix format specifiers in extension modules (GH-146617) (#147704)
Fix format specifier in parse_task_name() for long result.
2026-04-01 15:12:44 +02:00
Pablo Galindo SalgadoandGitHub 58c5eda24c [3.14] gh-146308: Fix error handling issues in _remote_debugging module (GH-146309) (#146398)
(cherry picked from commit ae6adc9079)
2026-03-25 01:05:47 +00:00
Pablo Galindo SalgadoandGitHub ded533b1fa [3.14] gh-144316: Fix missing exception in _remote_debugging with debug=False (GH-144442) (#145280) 2026-02-26 22:39:48 +00:00
Bartosz SławeckiandGitHub 616e611844 [3.14] gh-144563: Fix remote debugging with duplicate libpython mappings from ctypes (GH-144595) (#144655) 2026-02-10 14:31:49 +00:00
Victor StinnerandGitHub 5398d088f4 [3.14] gh-141784: Fix _remote_debugging_module.c compilation on 32-bit Linux (#141796) (#141800)
gh-141784: Fix _remote_debugging_module.c compilation on 32-bit Linux (#141796)

Include Python.h before system headers to make sure that
_remote_debugging_module.c uses the same types (ABI) than Python.

(cherry picked from commit 722f4bb8c9)
2025-11-20 18:13:03 +01:00
Victor StinnerandGitHub 36e9f672f2 [3.14] Fix compiler warnings in remote debugging (#141060) (#141067)
Fix compiler warnings in remote debugging (#141060)

Example of fixed warnings on 32-bit Windows:

    Python\remote_debugging.c(24,53): warning C4244: 'function':
    conversion from 'uint64_t' to 'uintptr_t', possible loss of data

    Modules\_remote_debugging_module.c(789,44): warning C4244:
    'function': conversion from 'uint64_t' to 'size_t', possible loss
    of data

(cherry picked from commit f458ac01ba)
2025-11-05 19:49:39 +00:00
7880421983 [3.14] gh-136476: Remove creation of unused list (GH-136494) (GH-136495)
(cherry picked from commit b44316a097)

Co-authored-by: Petr Viktorin <[email protected]>
2025-07-10 08:36:48 +00:00
4d025a2318 [3.14] gh-136476: Show the full stack in get_async_stack_trace in _remote_debugging (GH-136483) (#136490)
gh-136476: Show the full stack in get_async_stack_trace in _remote_debugging (GH-136483)
(cherry picked from commit ea45a2f97c)

Co-authored-by: Pablo Galindo Salgado <[email protected]>
2025-07-10 00:57:40 +01:00
9a79c5128f [3.14] gh-91048: Revert the memory cache removal for remote debugging (GH-136440) (#136443)
gh-91048: Revert the memory cache removal for remote debugging (GH-136440)
(cherry picked from commit 77d25e5b16)


gh-91048: Reintroduce the memory cache for remote debugging

Co-authored-by: Pablo Galindo Salgado <[email protected]>
2025-07-09 02:21:56 +01:00
Pablo Galindo SalgadoandGitHub c66b54f361 [3.14] gh-91048: Fix external inspection multi-threaded performance (GH-136005) (#136080)
(cherry picked from commit 5334732f9c)
2025-06-28 19:12:54 +01:00
Miss Islington (bot)andGitHub e89c7f1fc0 [3.14] gh-111178: fix UBSan failures for RemoteUnwinderObject (GH-135539) (#135547) 2025-06-15 22:54:23 +02:00
Miss Islington (bot)andGitHub 7fd8857b11 [3.14] gh-135371: Clean tags from pointers in all cases in remote debugging module (GH-135534) (#135545) 2025-06-15 19:05:39 +00:00
f8f99b1cfc [3.14] gh-135371: Fix asyncio introspection output to include internal coroutine chains (GH-135436) (#135509)
gh-135371: Fix asyncio introspection output to include internal coroutine chains (GH-135436)
(cherry picked from commit 028309fb47)

Co-authored-by: Pablo Galindo Salgado <[email protected]>
2025-06-15 18:38:56 +00:00
f303532857 [3.14] gh-91048: Reorder result tuple of parse_code_object (GH-134898) (#134956)
* gh-91048:  Reorder result tuple of parse_code_object (GH-134898)

Reorder result tuple of parse_code_object

The standard followed by APIs like pstat.Stats is to take a file, line,
function triplet. The parse_code_object function (and callers exposing
this in Python like RemoteUnwinder.get_stack_trace) return function,
file, line triplets which requires the caller to reorder these when
using it in classes like pstat.Stats.
(cherry picked from commit 8e8786f898)

Co-authored-by: László Kiss Kollár <[email protected]>

* Reorder asyncio

---------

Co-authored-by: László Kiss Kollár <[email protected]>
Co-authored-by: Pablo Galindo <[email protected]>
2025-06-11 01:33:46 +00:00
2a089244f0 [3.14] gh-134693: Fix [-Wmaybe-uninitialized] warning in _remote_debugging_module.c (GH-134694) (#134726)
gh-134693: Fix `[-Wmaybe-uninitialized]` warning in `_remote_debugging_module.c` (GH-134694)
(cherry picked from commit 806107d7a2)

Co-authored-by: sobolevn <[email protected]>
2025-05-26 15:32:52 +00:00
Miss Islington (bot)andGitHub aded785b8c [3.14] gh-91048: Add better error messages for remote debugging for CI builds (GH-134682) (#134719) 2025-05-26 15:04:36 +00:00
1822f33b1a [3.14] gh-91048: Refactor and optimize remote debugging module (#134652) (#134673)
gh-91048: Refactor and optimize remote debugging module (#134652)

Completely refactor Modules/_remote_debugging_module.c with improved
code organization, replacing scattered reference counting and error
handling with centralized goto error paths. This cleanup improves
maintainability and reduces code duplication throughout the module while
preserving the same external API.

Implement memory page caching optimization in Python/remote_debug.h to
avoid repeated reads of the same memory regions during debugging
operations. The cache stores previously read memory pages and reuses
them for subsequent reads, significantly reducing system calls and
improving performance.

Add code object caching mechanism with a new code_object_generation
field in the interpreter state that tracks when code object caches need
invalidation. This allows efficient reuse of parsed code object metadata
and eliminates redundant processing of the same code objects across
debugging sessions.

Optimize memory operations by replacing multiple individual structure
copies with single bulk reads for the same data structures. This reduces
the number of memory operations and system calls required to gather
debugging information from the target process.

Update Makefile.pre.in to include Python/remote_debug.h in the headers
list, ensuring that changes to the remote debugging header force proper
recompilation of dependent modules and maintain build consistency across
the codebase.

Also, make the module compatible with the free threading build as an extra :)

Co-authored-by: Łukasz Langa <[email protected]>

(cherry picked from commit 42b25ad4d3)
2025-05-25 22:10:20 +00:00
Miss Islington (bot)andGitHub e379a71811 [3.14] gh-91048: Fix error path result in _remote_debugging_module (GH-134347) (#134399) 2025-05-21 00:20:53 +00:00
Adam TurnerandGitHub 3f80165a26 GH-91048: Minor fixes for `_remotedebugging & rename to _remote_debugging` (#133398) 2025-05-05 02:30:14 +02:00