cpython icon indicating copy to clipboard operation
cpython copied to clipboard

GC may have inconsistent view of stacktop with deferred references

Open Fidget-Spinner opened this issue 9 months ago • 0 comments

In https://github.com/python/cpython/pull/118450, Sam pointed out that GC can occur at any Py_DECREF. With deferred references, we will need to traverse the object's stacks. The main problem is that frame->stacktop might not represent the true stacktop at a GC collection, because frame->stacktop is not set in between opcodes.

This requires either scanning the entire stack (not just up to stacktop), or deferring GC to safe points.

Linked PRs

  • gh-121318

Fidget-Spinner avatar May 10 '24 20:05 Fidget-Spinner