-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix file descriptor leak #6897
Fix file descriptor leak #6897
Conversation
This reverts commit bf82f75.
I think the first issue is fixed by this PR, I'm not sure about the other two. I'd like to test this with:
It seemed to me that litellm does some duck typing undercover and expects this |
I can confirm that this works with Claude via LiteLLM proxy. I'll test with o3_mini this afternoon |
Weird, Claude via AH litellm_proxy, console:
which becomes
Maybe I'm doing something wrong, I'll try main. It just looks to me like litellm may expect some other client, also this comment on your litellm PR suggests there may be different clients for providers? |
|
I see errors on this too - It looks like in some cases they expect the client object to be a HTTPHandler, and in others a different object type. That makes this... messy. |
@enyst - I have decided to come at this problem from a different direction - tracking the httpx client and closing it manually. It is an... unconventional approach, but I can see no other way aside from forking litellm, which I feel will add even more technical debt. (This fix will be transparent when the fix occurs, and can be removed at any later convenient time.) I can confirm that this solution works when using:
I can also confirm that it does not leak file descriptors. |
…OpenHands into fix-file-descriptor-leak-2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't test, but I think you're right this is the approach we need to take here. We've done some stuff like this before and hey, there will be some cases we'll do it again. If you think it's worth doing, let's go for it.
End-user friendly description of the problem this fixes or functionality that this introduces
This is a revert of #6887 (Which is itself a revert) with a fix for the log completions.
Give a summary of what the PR does, explaining any non-trivial design decisions
log_completions
functionality was not covered by any tests - so I added a test to cover this.client
from the logged kwargsLink of any specific issues this addresses
To run this PR locally, use the following command: