Skip to content

CUDA server silently stops accepting connections at the descriptor limit (default ulimit: ~600 idle connections) #293

Closed

Description

@plotarmordev

Found while testing #218 (@jayleaton suggested its own issue). With the default descriptor limit, the CUDA server silently stops accepting connections once it runs out of descriptors: no error, no log line, and requests just hang.

Setup. TensorFold 0.6.1, one DGX Spark (GB10), Vontra/Qwen3.8-Flash-Next-MLX-4bit-MTP @ dadefa80, in Docker with the default ulimit -n of 1024:

tensorfold serve Vontra/Qwen3.8-Flash-Next-MLX-4bit-MTP --name fn --port 8091 --parallel 1 --context 16384

What happens. Idle keep-alive connections opened in steps of 50, counting the server's descriptors (/proc/1/fd) after each step:

idle connections server descriptors (count, highest)
0 427, 426
500 927, 926
600 1,024, 1,023
650 to 726 1,024, 1,023
  • At about 600 idle connections the server reaches the limit. New connects then queue in the listen backlog and time out (the first failed at 726).
  • A chat request sent at that point got no reply in 30 s.
  • Nothing appears in the server log.
  • When the idle connections close, it answers again at once (HTTP 200 in 0.3 s).

Why it's silent. Server is a ThreadingHTTPServer (tensorfold/server/http.py), and the standard library's socketserver.BaseServer._handle_request_noblock returns on any OSError from accept(), so EMFILE is dropped without a trace. tensorfold/server/http.py hasn't changed that path since 0.6.1 (class Server is identical at 0.6.3). I measured on 0.6.1 and couldn't rerun on 0.6.3 on a GPU yet.

Reproduce. Any idle client connections do it, e.g. python3 -c "import socket,time; s=[socket.create_connection(('127.0.0.1',8091)) for _ in range(700)]; time.sleep(600)", then send a request.

Expected. At least a log line when accept() fails, so an operator can see why clients hang. Two ways to fix it, in my opinion: raise the soft RLIMIT_NOFILE to the hard limit at startup (an idle Flash Next server already holds 427 descriptors, close to half of 1024), and print once when accept() fails with EMFILE. Happy to send a PR if you want either.

Activity

  1. plotarmordev commented on Oct 3, 2026

    @plotarmordev
    ContributorAuthor

    Confirmed on 0.6.3 on a GB10: same limits, and while it's stuck the accept loop spins a core at 100%. Fix in #294.

  2. ashhart commented on Oct 3, 2026

    @ashhart
    Owner

    Thanks, @plotarmordev, for the measurements and for #294. It raises the soft open-file limit at start and logs when
    accept() runs out of descriptors. It's under test for the next release, and this issue closes when it ships.

  3. ashhart commented on Oct 6, 2026

    @ashhart
    Owner

    Thank you, @plotarmordev. The report and #294 made this easy. The Python engine is frozen (#286), so #294 won't ship in a Python release, and its fix landed in the Zig server instead, as 267cd3c. The Zig listener never had the silent spin, since it backs off 10 ms when accept runs out of descriptors. What it lacked is what your PR adds, raising the soft open-file limit at start and one log line when accepts run out. The commit carries your credit, and this issue closes with it.

  4. added a commit that references this issue on Oct 8, 2026
    27c764a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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