Skip to content

Commit c179184

Browse files
committed
fixup! pythongh-151613: Fix remote debugging frame cache ABA
1 parent fc9fafd commit c179184

1 file changed

Lines changed: 0 additions & 84 deletions

File tree

‎Lib/test/test_external_inspection.py‎

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -3451,90 +3451,6 @@ def level1():
34513451
# Parent frames: must match exactly
34523452
self.assertEqual(loc_cached, loc_no_cache)
34533453

3454-
@skip_if_not_supported
3455-
@unittest.skipIf(
3456-
sys.platform != "linux" or not PROCESS_VM_READV_SUPPORTED,
3457-
"Test only runs on Linux with process_vm_readv support",
3458-
)
3459-
def test_cache_rejects_reused_frame_address_aba(self):
3460-
"""Test that frame address reuse cannot splice cached parent frames."""
3461-
script_body = """\
3462-
sock.sendall(b"ready")
3463-
3464-
def burn_a():
3465-
total = 0
3466-
for i in range(20000):
3467-
total += i
3468-
return total
3469-
3470-
def burn_b():
3471-
total = 0
3472-
for i in range(20000):
3473-
total += i
3474-
return total
3475-
3476-
def a_leaf():
3477-
return burn_a()
3478-
3479-
def b_leaf():
3480-
return burn_b()
3481-
3482-
def a_parent():
3483-
return a_leaf()
3484-
3485-
def b_parent():
3486-
return b_leaf()
3487-
3488-
while True:
3489-
a_parent()
3490-
b_parent()
3491-
"""
3492-
3493-
with self._target_process(script_body) as (p, client_socket, _):
3494-
_wait_for_signal(client_socket, b"ready")
3495-
unwinder = RemoteUnwinder(
3496-
p.pid, cache_frames=True, stats=True
3497-
)
3498-
bad_stacks = []
3499-
seen = 0
3500-
branch_a = {"a_parent", "a_leaf", "burn_a"}
3501-
branch_b = {"b_parent", "b_leaf", "burn_b"}
3502-
3503-
for _ in range(8000):
3504-
try:
3505-
traces = unwinder.get_stack_trace()
3506-
except TRANSIENT_ERRORS:
3507-
continue
3508-
for interp in traces:
3509-
for thread in interp.threads:
3510-
in_a = False
3511-
in_b = False
3512-
for frame in thread.frame_info:
3513-
name = frame.funcname
3514-
if name in branch_a:
3515-
in_a = True
3516-
elif name in branch_b:
3517-
in_b = True
3518-
if in_a and in_b:
3519-
break
3520-
if not (in_a or in_b):
3521-
continue
3522-
seen += 1
3523-
if in_a and in_b:
3524-
funcs = [f.funcname for f in thread.frame_info]
3525-
bad_stacks.append(funcs)
3526-
if len(bad_stacks) >= 3:
3527-
break
3528-
3529-
stats = unwinder.get_stats()
3530-
3531-
self.assertGreater(seen, 0)
3532-
self.assertGreater(
3533-
stats["frame_cache_hits"] + stats["frame_cache_partial_hits"], 0
3534-
)
3535-
self.assertGreater(stats["frames_read_from_cache"], 0)
3536-
self.assertEqual(bad_stacks, [])
3537-
35383454
@skip_if_not_supported
35393455
@unittest.skipIf(
35403456
sys.platform == "linux" and not PROCESS_VM_READV_SUPPORTED,

0 commit comments

Comments
 (0)