Skip to content
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_gc: refactor and silence flaky assertion on freethreaded build #4628

Merged
merged 2 commits into from
Oct 18, 2024

Conversation

davidhewitt
Copy link
Member

This is a cleanup of the test_gc.rs test suite after we have a flaky assertion in CI causing a lot of failed merges. (See #4627)

Here I've just cleaned up the test suite to make more use of common code and silenced the flaky warning so it doesn't block us while we investigate later. I'll merge this now to unblock CI, if there are comments / suggestions post-merge I am happy to raise a follow-up PR.

@davidhewitt davidhewitt added the CI-skip-changelog Skip checking changelog entry label Oct 18, 2024
Comment on lines +613 to +637
#[cfg(not(Py_GIL_DISABLED))]
{
// FIXME: seems like a bug that this is flaky on the free-threaded build
// https://github.com/PyO3/pyo3/issues/4627
check.assert_drops_with_gc(ptr);
}

assert!(drop_called.load(Ordering::Relaxed));
#[cfg(Py_GIL_DISABLED)]
Copy link
Member Author

@davidhewitt davidhewitt Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @ngoldbaum

The check.assert_drops_with_gc helper is an addition higher up in the file. On freethreaded build it runs gc.collect() and then sleeps, in a loop. The interesting is no matter how long I let the loop run (e.g. 1 minute or more), this object never gets dropped. That's what makes me think it's likely a bug.

(It seems like __clear__ is never called, though I think I did observe __traverse__ being called.)

@davidhewitt davidhewitt enabled auto-merge October 18, 2024 13:07
@davidhewitt davidhewitt added this pull request to the merge queue Oct 18, 2024
Merged via the queue into PyO3:main with commit a106058 Oct 18, 2024
42 of 43 checks passed
@davidhewitt davidhewitt deleted the flaky-gc-tests branch October 18, 2024 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI-skip-changelog Skip checking changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant