fix(ai): Resolve Memory Leak in Asynchronous Gemini API SSE Stream Handler (#3949) - #4044
Conversation
|
@knoxiboy is attempting to deploy a commit to the ritesh Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
Fixes an unclosed connection and buffer memory leak in
backend/services/gemini_stream_service.pyby ensuring explicit generator cleanup andAsyncClientclosure when SSE stream connections terminate or disconnect unexpectedly.Related Issue
Fixes #3949
Type of Change
Checklist
Additional Notes
Wraps SSE event generator iterations in explicit
try...finallyblocks to release active client sockets.