-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_regrtest: test_huntrleaks() fails randomly: leaked [9, 1, 1] references #109739
Comments
I cannot reproduce the issue on Linux. I stopped the stress test after 19 minutes:
|
I failed to reproduce the issue on Windows with this command:
I interrupted the test after 17 minutes. |
To reproduce the issue on Windows, create the file import unittest
GLOBAL_LIST = []
class RefLeakTest(unittest.TestCase):
def test_leak(self):
GLOBAL_LIST.append(object()) And run the script import sys
import subprocess
while True:
sys.stdout.write(".")
sys.stdout.flush()
cmd = [sys.executable, "-m", "test", "-R", "3:3", "test_leak"]
proc = subprocess.run(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True)
if "test_leak leaked [1, 1, 1] references" in proc.stdout:
continue
print(proc.stdout, end="")
if proc.returncode:
print(f"FAILED: exit code {proc.returncode}")
break |
And more the system less determistic by running the following command in a different terminal:
Example of the bug on Windows:
|
I can still reproduce the leak even if I disable the bytecode specialization. diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h
index a77fa11baf..7de6384574 100644
--- a/Include/internal/pycore_code.h
+++ b/Include/internal/pycore_code.h
@@ -236,7 +236,7 @@ extern int _PyLineTable_PreviousAddressRange(PyCodeAddressRange *range);
/** API for executors */
extern void _PyCode_Clear_Executors(PyCodeObject *code);
-#define ENABLE_SPECIALIZATION 1
+#define ENABLE_SPECIALIZATION 0
/* Specialization functions */
|
"before" variables when the bug occurs:
"before" variables when the bug does not occur:
Only rc_before is different: 94 333 (ok) => 94 336 (bug). |
Oooooooh, the issue comes from regrtest logger: from WindowsLoadTracker thread. |
Disable the Windwos load tracker when hunting reference leak.
Disable the Windwos load tracker when hunting reference leak.
Disable the Windwos load tracker when hunting reference leak.
Disable the Windwos load tracker when hunting reference leak.
regrtest: Fix reference leak check on Windows. Disable the load tracker on Windows in the reference leak check mode (-R option).
regrtest: Fix reference leak check on Windows. Disable the load tracker on Windows in the reference leak check mode (-R option).
…9871) regrtest: Fix reference leak check on Windows. Disable the load tracker on Windows in the reference leak check mode (-R option).
…9871) regrtest: Fix reference leak check on Windows. Disable the load tracker on Windows in the reference leak check mode (-R option).
Failure on GHA Windows x86 CI:
build: https://github.com/python/cpython/actions/runs/6274556366/job/17041487300?pr=109727
Linked PRs
The text was updated successfully, but these errors were encountered: