-
-
Notifications
You must be signed in to change notification settings - Fork 31.2k
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_repl's test_no_memory: AssertionError: -6 not found in (1, 120) #118331
Comments
I am able to reproduce it locally when checking out #118283 (but not in main for whatever reason). The bug I saw was due to We should call |
When detaching a dict, the copy_values call may fail due to out-of-memory errors. This can be triggered by test_no_memory in test_repl.
…ng weakrefs (#118338) It's not safe to raise an exception in `PyObject_ClearWeakRefs()` if one is not already set, since it may be called by `_Py_Dealloc()`, which requires that the active exception does not change. Additionally, make sure we clear the weakrefs even when tuple allocation fails.
When detaching a dict, the `copy_values` call may fail due to out-of-memory errors. This can be triggered by test_no_memory in test_repl.
@hugovk, both PRs are now merged. When you get a chance to merge |
Passing now, thank you! After the first run, 5 tests failed on "Windows (free-threading) / build and test (x86)" but passed when restarted. https://github.com/python/cpython/actions/runs/8884999534/attempts/1 https://github.com/python/cpython/actions/runs/8884999534/job/24396359883 |
It looks like this wasn't fully fixed, I'm seeing failures on my PR: #130469 The test case seems to pass on main, but my PR triggers the failure again for whatever reason. On main, actually running the snippet from the test in the REPL results in an assertion failure, and a hang on 3.13 release builds:
|
I think there are three separate issues on main that are being tickled. I haven't had a chance to investigate 3.13.
1. First, I think the assertion failure that @ZeroIntensity reported on the default build is because
Allocating the list object succeeds because it is handled by the free list. Allocating the items array fails, and we decref the the list object that was returned from the free list: Lines 259 to 263 in 1e4a434
The decref destroys the last reference, calls Lines 2970 to 2972 in 1e4a434
Since cpython/Python/generated_cases.c.h Lines 1017 to 1019 in 1e4a434
I'm not sure what the right solution is. I think 2. After working around the above, we hit another assertion that I believe is caused by unconditionally clearing
We're triggering this assertion: cpython/Python/generated_cases.c.h Lines 11987 to 11989 in 1e4a434
because no exception is set:
Running backwards, we can see that the exception is cleared in
Lines 74 to 79 in 1e4a434
In this case, there was a pre-existing PyObject *exc = PyErr_GetRaisedException();
PyFrameObject *back = _PyFrame_GetFrameObject(prev);
if (back == NULL) {
/* Memory error here. */
assert(PyErr_ExceptionMatches(PyExc_MemoryError));
/* Nothing we can do about it */
PyErr_Clear();
}
else {
f->f_back = (PyFrameObject *)Py_NewRef(back);
}
PyErr_SetRaisedException(exc); After this, it looks like things are working again on the default build:
3. It looks like there's another issue in the free-threaded build that we hit:
Again, we're attempting to allocate a new list. Allocating the list object succeeds because it's returned from the free list, but allocating the items array fails: Lines 250 to 255 in 1e4a434
Since we hold the only reference, the decref ends up calling Lines 526 to 536 in 1e4a434
I think setting setting
After this, the free-threaded build no longer crashes:
|
Bug report
Bug description:
One of my PRs (#118283) started failing (https://github.com/python/cpython/actions/runs/8843882336?pr=118283) with this. Investigating, I can reproduce it locally on
main
, although I don't know why the CI passes onmain
.OS: macOS Sonoma 14.4.1, M2.
To reproduce
Actual result
Printing
output
from the test:Expected result
It passes with
v3.13.0a5
, whereoutput
is:The main difference is the failure includes this:
Bisecting
PR: #117168
Issue: #111926
The PR was merged three weeks ago and the CI is passing.
On my PR (https://github.com/python/cpython/actions/runs/8843882336?pr=118283), free-threaded builds pass, but regular ones fail. Ubuntu and macOS fail with:
Windows with:
3221225477 seems to be 0xc0000005
STATUS_ACCESS_VIOLATION
.CPython versions tested on:
3.13
Operating systems tested on:
macOS
Linked PRs
The text was updated successfully, but these errors were encountered: