Skip to content

Connections aren't being closed #140

Closed
@dougli

Description

@dougli

The library uses requests to fetch data from OpenAI servers, but we never call .close() on those connections which leaves dangling open file handles on the OS.

Can we clean these connections up gracefully, either after a period of time, or after making a request? There is an advantage to leaving it open as it doesn't have to do the HTTPS handshake on every request, but we should clean this up properly after a period of idleness.

This bug interacts very poorly with another bug in Docker Desktop -- moby/vpnkit#587; the openai library stops working entirely after running it in a Docker container on Mac / Windows for a few minutes. All requests to OpenAI servers time out indefinitely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions