Skip to content

new sessions evert 3 minutes #616

@ShantanuNair

Description

@ShantanuNair

Describe the bug

https://github.com/openai/openai-python/blob/e389823ba013a24b4c32ce38fa0bd87e6bccae94/openai/api_requestor.py#L590C2-L590C2

This MAX_SESSION_LIFETIME_SECS setting kills sessions after 3 minutes. I believe this breaks long running tasks. It would also be difficult to troubleshoot downstream issues if the client is killing sessions at an arbitrary 3 minutes. Can someone verify the PR the brought this change is 100% good to go? It seems to me like this shouldn't be there, or at least be configurable, and that it would mess with users passing in sessions.

elif (
            time.time() - getattr(_thread_context, "session_create_time", 0)
            >= MAX_SESSION_LIFETIME_SECS
        ):
            _thread_context.session.close()
            _thread_context.session = _make_session()
            _thread_context.session_create_time = time.time()

@jhallard

To Reproduce

Run a long running llm request, and a new session is created after 3 minutes during.

Code snippets

No response

OS

macOS

Python version

3.8

Library version

openai-python v0.28.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixed in v1Issues addressed by the v1 beta

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions