Skip to content

test_monitoring fails when run multiple times: ValueError: tool 0 is already in use #109357

Description

@vstinner

The issue broke all Refleaks buildbots :-(

Example:

$ ./python -m test test_monitoring -R 3:3
0:00:00 load avg: 3.50 Run 1 test sequentially
0:00:00 load avg: 3.50 [1/1] test_monitoring
beginning 6 repetitions
123456
.test test_monitoring failed -- Traceback (most recent call last):
File "/home/vstinner/python/main/Lib/test/test_monitoring.py", line 1723, in test_gh108976
sys.monitoring.use_tool_id(0, "test")
ValueError: tool 0 is already in use
test_monitoring failed (1 error)
== Tests result: FAILURE ==
1 test failed:
test_monitoring
Total duration: 454 ms
Total tests: run=63
Total test files: run=1/1 failed=1
Result: FAILURE

The regression was introduced by: commit 4a69301 of PR GH-109131. cc @markshannon

commit 4a69301ea4539da172a00a80e78c07e9b41c1f8e
Author: Mark Shannon <mark@hotpy.org>
Date: Mon Sep 11 14:37:09 2023 +0100
GH-108976. Keep monitoring data structures valid during de-optimization during callback. (GH-109131)

Python 3.12 is also affected, the change was backported to 3.12: cc @Yhg1s

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions