Skip to content

gh-132296: Use thread-state reference counting to fix PyEval_SetTraceAllThreads - #132298

Closed
ZeroIntensity wants to merge 9 commits into
python:mainfrom
ZeroIntensity:gh-132296-set-trace-all-threads
Closed

ZeroIntensity wants to merge 9 commits into
python:mainfrom
ZeroIntensity:gh-132296-set-trace-all-threads

Conversation

@ZeroIntensity

@ZeroIntensity ZeroIntensity commented Apr 9, 2025 •

Copy link
Copy Markdown
Member

This extends the refcount field to affect PyThreadState_Delete and friends, letting us keep a thread state alive for slightly longer. This mechanism is far from being robust, because we're still not preventing the thread state from being cleared or other bad things, but it's a really nice start.

We could go the route of letting the reference count field prevent any finalization happening to the thread state, but I want to hear opinions on this approach first.

@ZeroIntensity

Copy link
Copy Markdown
Member Author

@colesbury -- As you implemented tstate refcounts, I'd like to hear your opinion on this. Do you think using reference counting before finalization is a good idea?

@ZeroIntensity

Copy link
Copy Markdown
Member Author

I realize that this only fixes concurrent deletion, but not concurrent mutation. Silly me.

@ZeroIntensity
ZeroIntensity deleted the gh-132296-set-trace-all-threads branch April 28, 2025 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant