Skip to content

Conversation

@paultiq
Copy link
Owner

@paultiq paultiq commented Sep 16, 2025

No description provided.

paultiq and others added 30 commits September 14, 2025 05:07
…ildwheel to include 3.14rc2, and handle new pandas warning, and mark unsupported packages as < 3.14.
…ulti-phase init and accessed via GetModuleState()
@paultiq paultiq changed the base branch from ci314t_sccache to sccache_ci September 17, 2025 20:28
}

shared_ptr<DuckDBPyConnection> DuckDBPyModuleState::GetDefaultConnection() {
lock_guard<mutex> guard(default_connection_mutex);
Copy link

@ngoldbaum ngoldbaum Sep 18, 2025

Choose a reason for hiding this comment

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

Is the GIL held here? I don't know pybind11 well enough to tell. If it is then you have to explicitly release it before locking a mutex, which is a possibly blocking operation. Otherwise you might deadlock with the GIL (or the garbage collector on the free-threaded build).

This is what MutexExt in PyO3 does. I don't know if there's something equivalent in pybind11. There probably should be if there isn't!

If you don't hold the GIL at this point then disregard all that. But also double-check everywhere else you are doing a possibly-blocking call with a standard library synchronization primitive.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Thinking this through...

For context: I'm starting from code that is "GIL" safe, so mostly trying to preserve existing behavior / not change anything.

The GIL should be held in these paths; I didn't add a check, but I'll add a todo to consider a safety check.

The mutexes were just placeholders: next commit replaces them with an ifdef check for free threading and then either a mutex or a scoped_critical_section.

@paultiq paultiq closed this Sep 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants