fix(sessions): resolve async deadlock in multiplexed session manager#1520
fix(sessions): resolve async deadlock in multiplexed session manager#1520sinhasubham merged 1 commit intomainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical deadlock that previously occurred in the asynchronous multiplexed session manager. The core problem stemmed from using a synchronous Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively resolves a critical deadlock in the asynchronous multiplexed session manager by correctly switching from a synchronous threading.Lock to an async-aware CrossSync.Lock. The inclusion of a new concurrency test is a great addition that validates the fix. Most other changes are stylistic improvements. I've identified one minor issue involving what appears to be dead code, which should be removed for better code clarity.
b792e80 to
560d4b9
Compare
This PR resolves a critical deadlock issue when acquiring or maintaining a multiplexed session asynchronously.
The bug occurs because DatabaseSessionsManager previously used a synchronous threading.Lock around self._get_multiplexed_session() and _maintain_multiplexed_session(). When a thread attempts to await the multiplexed session creation (return await ...) while holding a synchronous thread lock, the entire asyncio event loop becomes blocked for any other coroutine trying to access the lock.