Bug report
Bug description:
I'm benchmarking sampling.profiler and I realized unwind_stack_for_thread issues _Py_RemoteDebug_PagedReadRemoteMemory on every sample and on every thread.
|
// Read GC collecting state from the interpreter (before any skip checks) |
|
uintptr_t interp_addr = GET_MEMBER(uintptr_t, ts, unwinder->debug_offsets.thread_state.interp); |
|
|
|
// Read the GC runtime state from the interpreter state |
|
uintptr_t gc_addr = interp_addr + unwinder->debug_offsets.interpreter_state.gc; |
|
char gc_state[SIZEOF_GC_RUNTIME_STATE]; |
|
if (_Py_RemoteDebug_PagedReadRemoteMemory(&unwinder->handle, gc_addr, unwinder->debug_offsets.gc.size, gc_state) < 0) { |
|
set_exception_cause(unwinder, PyExc_RuntimeError, "Failed to read GC state"); |
|
goto error; |
|
} |
|
STATS_INC(unwinder, memory_reads); |
|
STATS_ADD(unwinder, memory_bytes_read, unwinder->debug_offsets.gc.size); |
seems it should've been removed with 274a26c.
The result is not used, it pollutes the stats and there's a risk of failing over data that's not even used?
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
Bug report
Bug description:
I'm benchmarking
sampling.profilerand I realizedunwind_stack_for_threadissues_Py_RemoteDebug_PagedReadRemoteMemoryon every sample and on every thread.cpython/Modules/_remote_debugging/threads.c
Lines 317 to 328 in 665b7df
seems it should've been removed with 274a26c.
The result is not used, it pollutes the stats and there's a risk of failing over data that's not even used?
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
_remote_debugging: Remove dead code, unnecessary gc state read #148990