Skip to content

fix(umbp): SSD tier no longer runs out of fds or misreports parallel-drive reads - #754

Merged
TianDi101 merged 4 commits into
mainfrom
fix/umbp-ssd-tier-silent-failures
Oct 13, 2026
Merged

TianDi101 merged 4 commits into
mainfrom
fix/umbp-ssd-tier-silent-failures

Conversation

@TianDi101

@TianDi101 TianDi101 commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Two SSD-tier bugs that make reads or writes fail with nothing in the log that says why. Both were found by running a 300 GB DRAM → 1.5 TB SSD UMBP tier (3 NVMe drives) under the InferenceY agentic workload. Both apply to any file-backed SSD tier, with or without eviction demotion. This is PR 1 of the split of #753; it applies on main alone.

1. The SSD tier runs out of file descriptors (d975d67e7, 2424c16c7, ee0686af3)

Bug. SSDTier keeps every segment file open for the tier's lifetime. At the old 256 MiB default a 1.5 TB tier needed about 5,600 descriptors, but Docker's default soft RLIMIT_NOFILE is 1,024. Once the process reached it, the next segment open failed with EMFILE, and from then on every write to the tier failed: 218k in one run. The log only said backend write failed.

Fix.

  • The default segment size is now 4 GiB (ee0686af3). The same 1.5 TB tier needs about 350 descriptors, which fits under the default soft limit without raising anything. Segments aren't preallocated, segment offsets are 64-bit, and the reopen scan reads one record at a time, so nothing else depends on the size.
  • UMBP's own executables raise their limit (2424c16c7). umbp_standalone_server and umbp_tier_bench raise the soft limit to the hard limit at the top of main() with RaiseOpenFileLimit() (umbp/common/fd_limit.h), as dbus and Go do. This needs no privileges and never touches the hard limit.
  • The library only checks. MakeFileSsdBackend also runs inside sglang's scheduler (embedded mode), where changing the process-wide limit would quietly override the host's setting. It would also let other code in that process get fds above 1,024, where select() corrupts memory, and pass the raised limit to child processes. So it logs an error when the fds already open plus the tier's segment files won't fit under the soft limit, and names the fix (ulimit -n, docker --ulimit nofile, or ssd.segment_size_bytes). d975d67e7 first raised the limit inside the library; 2424c16c7 moves it out.
  • A failed segment open now logs the path and strerror(errno) (rate-limited) and records an IoError status.

Limitation. Capacity bounds the fd count only while nothing is evicted. The tier never reclaims evicted space (#755), so under churn it keeps opening new segments. 4 GiB segments make that 16× slower, but only the #755 fix bounds it.

2. A multi-drive SSD tier reports successful reads as failed (cb3e2b811)

Bug. ShardedSsdTier::FanOutBatches runs one worker per drive, and each worker wrote its keys' results into the caller's std::vector<bool>. The indices are disjoint, but vector<bool> packs elements into shared words. Two drives finishing together each read-modify-wrote the other's word and could write back a stale false. A read that succeeded came back as failed: 16 and 42 times in two runs, always under parallel SSD load. sglang's UMBP linker treats a failed get after a hit as fatal, so each one killed a scheduler. SSDTier's own result paths already use vector<char> for this reason.

Fix. Workers fill a std::vector<char>, and the bool results are written after they join.

Test plan

  • SsdBackendTest.LeavesTheOpenFileLimitToTheExecutable: lowers the soft limit to 1,024, starts a tier, and checks the limit is unchanged. Then it checks that RaiseOpenFileLimit() lifts it to the hard limit. The original limit is restored even if the test fails.
  • New: test_parallel_drives_never_lose_a_result (in test_sharded_ssd_tier), a stress test of 4,096 keys over three drives and 200 batch reads. It guards the path but doesn't reproduce the race, which needs two workers' few-microsecond result loops to overlap.
  • Full tests/cpp/umbp suite on this branch (build in rocm/mori-dev, with RDMA): 51/52 under ctest -j 8. The one that aborted, umbp_cross_node_smoke, is a pre-existing RDMA-contention flake that also fails on main. Run one at a time, it and the other known flake, umbp_pool_client_ranges, both passed 3 of 3.
  • By hand, under Docker's default limits (soft 1,024, hard 524,288): umbp_standalone_server logs raised RLIMIT_NOFILE soft 1024 -> 524288, and /proc/<pid>/limits shows it. With both limits forced to 200, the library logs its error naming the fix, and the tier still works.
  • End to end, on the combined branch (feat(umbp): one eviction path with async DRAM→SSD demotion, masterless metrics, and fixes from an e2e run #753): after both fixes, a 2-hour run with 1.48M demotions and 60M SSD reads had 0 SSD read or write failures. That run used the earlier in-library raise and 256 MiB segments; the fd change in this PR has only been tested by the suite.

🤖 Generated with Claude Code

TianDi101 and others added 2 commits October 12, 2026 14:18
…not open

SSDTier keeps every 256 MiB segment file open for the tier's lifetime, so a
full 1.5 TB tier holds ~5,900 descriptors.  Under docker's default soft
RLIMIT_NOFILE of 1,024 the e2e run's standalone server reached 1,022 open
fds with 973 segments; the next segment open failed with EMFILE and from
then on every write to the tier failed (110k demotions in ten minutes),
with nothing in the log but "backend write failed".

MakeFileSsdBackend now sizes the descriptors every file tier in the process
needs (capacity / segment size, plus each shard's active segment, plus
headroom) and raises the soft limit toward the hard one, logging an error
when even the hard limit is too small.  A failed segment open logs the path
and errno (rate-limited) instead of failing silently.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ailed

ShardedSsdTier fans a batch out to one worker per drive and each worker
wrote its keys' results into the caller's std::vector<bool>.  The indices
are disjoint, but vector<bool> elements are not separate memory locations:
they share words, so two drives finishing together each read-modify-wrote
the word holding the other's results and could put back a stale false.  A
read or write that succeeded came back failed -- 16 and 42 times in two
DRAM->SSD demotion e2e runs, always under parallel SSD load, never
reproduced below the shard layer (SSDTier's own result paths already use
vector<char> for this reason).  The linker treats a failed get after a hit
as fatal, so each one cost a scheduler.

The workers now fill a vector<char> and the bool results are written after
they join.  The new stress test (4,096 keys over three drives, 200 batch
reads) guards the path; it does not reproduce the race, which needs two
workers' few-microsecond result loops to overlap.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
TianDi101 and others added 2 commits October 13, 2026 02:55
…ecks it

The previous commit raised the soft RLIMIT_NOFILE inside MakeFileSsdBackend.
That is a library call, and in embedded mode it runs inside sglang's
scheduler: building a tier quietly changed a process-wide limit the host
owns, let other code in that process get fds above 1,024 (where select()
corrupts memory), and passed the raised limit to every child it starts.

The raise now lives in the executables that host file SSD tiers --
umbp_standalone_server and umbp_tier_bench -- which lift the soft limit to
the hard one at the top of main(), as dbus and Go do.  MakeFileSsdBackend
only checks: it logs an error when the fds already open plus the tier's
segment files will not fit under the soft limit, and names the fix (ulimit
-n / docker --ulimit nofile, or ssd.segment_size_bytes).  The process-wide
`planned` counter, which only ever grew, is gone, and the test restores the
original limit even when it fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every segment file keeps an fd open for the tier's lifetime, so the 256 MiB
default made a 1.5 TB tier need ~5,900 descriptors, far past the usual soft
RLIMIT_NOFILE of 1,024; the e2e run's standalone server hit EMFILE at 973
segments.  At 4 GiB the same tier needs ~350, which fits under the default
soft limit without raising anything (embedded mode included), and under
churn, where evicted space is not reclaimed (#755), the fd count grows 16x
more slowly.

Segments are not preallocated (files grow as records are appended), segment
offsets are 64-bit, and the reopen scan reads one record at a time, so
nothing else depends on the size.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant