Skip to content

Distributed JACCL server crashes when two requests arrive concurrently #1737

Description

@nachogala

Distributed JACCL server crashes when two requests arrive concurrently

Summary

With a distributed mlx_lm.server deployment using the JACCL backend, a
single request completes successfully, but two HTTP requests submitted at the
same time cause both distributed ranks to terminate. The clients receive an
empty reply (curl 52/HTTP 000).

Environment

  • macOS on two Apple Silicon hosts with unified memory
  • mlx==0.32.0
  • mlx-metal==0.32.0
  • mlx-lm==0.31.3
  • Python 3.11
  • Distributed launch via mlx.launch with a two-host JACCL hostfile
  • OpenAI-compatible HTTP server endpoint

Reproduction

  1. Start the distributed server with the JACCL backend and wait for
    /v1/models to return HTTP 200.
  2. Submit one normal completion request; it returns HTTP 200.
  3. Submit two otherwise valid completion requests concurrently (for example,
    two simultaneous POST /v1/chat/completions requests).
  4. Repeat with both requests using the same generation mode. The failure is
    not specific to mixing reasoning/thinking modes.

Expected behavior

The server should serialize or safely schedule concurrent requests, or return
an explicit overload response without terminating either distributed rank.

Actual behavior

Both requests fail with an empty HTTP response. The distributed server logs
include messages equivalent to:

_pickle.UnpicklingError: invalid load key
[jaccl] Recv failed with error code -12
rank 0 exited with code 255

The peer rank exits as part of the same failure. After the crash, the server
endpoint is unavailable until restarted.

Additional observations

  • A single request succeeds immediately before the concurrent pair.
  • The failure reproduces with thinking=false + thinking=false,
    thinking=true + thinking=true, and mixed modes.
  • The failure occurs in both supervised and manually launched server modes.
  • Serializing admission at the HTTP boundary avoids the concurrent crash, but
    that is only a workaround and removes parallel request handling.

Could the JACCL transport or distributed server path support concurrent
request admission? If concurrency is currently unsupported, an explicit
server-side queue/lock or a documented limitation would prevent a process-wide
crash.

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