Skip to content

Constant deadlocks with any async usage #42

Open
@csvance

Description

@csvance

Constantly getting random deadlocks with this error message when I use the non blocking client in an async context:

┌ Error: curl_multi_socket_action: 8
└ @ Downloads.Curl ~/.virtualenvs/full-solution/julia_env/pyjuliapkg/install/share/julia/stdlib/v1.11/Downloads/src/Curl/utils.jl:57

Here is how I am doing async:

@sync
    B = Int64(N ÷ max_batch_size)
    if mod(N, max_batch_size) != 0
        B+= 1
    end
    
    channel = Channel(B)
    
    i = 1
    while i <= N
        j = min(N, (i + max_batch_size) - 1)
        input__0 = NetworkInput("INPUT__0", Float32.(C[i:j, :, :]))
        let i = i, j = j
            TritonInferAsync(client, model, [input__0], (r) -> put!(channel, (r, [i, j])))
        end
        i = i + max_batch_size
    end
    
    for b in 1:B
        response, ij = take!(channel)
        let response=response; ij=ij
            ...
        end
    end
end
julia> versioninfo()
Julia Version 1.11.5
Commit 760b2e5b739 (2025-04-14 06:53 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 128 × AMD EPYC 7773X 64-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver3)
Threads: 1 default, 0 interactive, 1 GC (on 128 virtual cores)

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