Skip to content

Should use threading.RLock instead of threading.Lock in _synchronization.py #996

@sandro-qiang

Description

@sandro-qiang

Or, it may be deadlock, as the following callstack

Thread 2885 (idle): "MainThread"
    __enter__ (httpcore/_synchronization.py:268)
    close (httpcore/_sync/connection_pool.py:416)
    __iter__ (httpcore/_sync/connection_pool.py:406)
    __iter__ (httpx/_transports/default.py:128)
    __iter__ (httpx/_client.py:154)
    iter_raw (httpx/_models.py:954)
    iter_bytes (httpx/_models.py:900)
    __init__ (httpcore/_synchronization.py:241)
    __init__ (httpcore/_sync/connection.py:66)
    create_connection (httpcore/_sync/connection_pool.py:168)
    _assign_requests_to_connections (httpcore/_sync/connection_pool.py:326)
    handle_request (httpcore/_sync/connection_pool.py:228)
    handle_request (httpx/_transports/default.py:250)
    _send_single_request (httpx/_client.py:1014)
    _send_handling_redirects (httpx/_client.py:979)
    _send_handling_auth (httpx/_client.py:942)
    send (httpx/_client.py:914)
    _request (openai/_base_client.py:955)
    request (openai/_base_client.py:919)
    post (openai/_base_client.py:1242)
    create (openai/resources/chat/completions/completions.py:914)

the version of httpcore is 1.0.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions