Repository navigation
Periodically close open request.Sessions to avoid buggy interaction with Docker Desktop - #478
Merged
Merged
Conversation
…ndle issues (#179) As reported from the field - we create a `requests.Session` object on first request to the servers and then reuse it indefinitely. This can leave some open file handles on the OS (not a big deal), but can interact poorly with a bug in Docker Desktop which causes the SDK to entierly break connections to the server. See #140 for more info.
* [EZ] Remove sort-by-key when rendering JSON responses The order of items in the API responses is intentional, and this order is clobbered by the rendering of `OpenAIObject`. This change removes the alphabetic sort of response keys * [EZ] Add unit test for new case * Lint/fmt fixes * Bleh isort * Remove `internal_metrics` field
hallacy
approved these changes
Jun 5, 2023
|
When use multi processing in docker desktop, we are also facing connection abort issue. I have another PR to fix it. #579 Could you help to review? |
megamanics
pushed a commit
to devops-testbed/openai-python
that referenced
this pull request
Aug 14, 2024
… with Docker Desktop (openai#478) * Periodically refresh open `requests.Session`s to mitigate open filehandle issues (openai#179) As reported, we create a `requests.Session` object on first request to the servers and then reuse it indefinitely. This can leave some open file handles on the OS (not a big deal), but can interact poorly with a bug in Docker Desktop which causes the SDK to entierly break connections to the server. See openai#140 for more info. The order of items in the API responses is intentional, and this order is clobbered by the rendering of `OpenAIObject`. This change removes the alphabetic sort of response keys
cgayapr
pushed a commit
to cgayapr/openai-python
that referenced
this pull request
Dec 14, 2024
… with Docker Desktop (openai#478) * Periodically refresh open `requests.Session`s to mitigate open filehandle issues (openai#179) As reported, we create a `requests.Session` object on first request to the servers and then reuse it indefinitely. This can leave some open file handles on the OS (not a big deal), but can interact poorly with a bug in Docker Desktop which causes the SDK to entierly break connections to the server. See openai#140 for more info. The order of items in the API responses is intentional, and this order is clobbered by the rendering of `OpenAIObject`. This change removes the alphabetic sort of response keys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes #140 by forcing open
Sessions to be closed periodically (every 3 minutes at most). This PR also changes the rendering of API responses to maintain the sorting provided by the backend.