Skip to content

test-stress FD exhaustion subtest fails with default macOS file-descriptor limit #68

@LeoriumDev

Description

@LeoriumDev

make check fails on test-stress:

test-stress                                   [ FAIL ] (exit 1)
    test-stress: resource limit stress tests
      32 concurrent threads          OK
      mmap/munmap churn (256 cycles) OK
      128 concurrent mmap regions    OK
      FD exhaustion (EMFILE)         FAIL: too few FDs opened before exhaustion (errno=24)
      mprotect RW->RX->RW cycling (64x) OK
      large mmap (16MiB)             OK

The subtest at tests/test-stress.c:222 expects to open ≥ 500 pipe FDs before EMFILE. On a default macOS shell session that's not reliable, pipe(2) returns EMFILE earlier. ulimit -n 65536 before make check and the test passes.

It's not an elfuse internal cap: FD_TABLE_SIZE = 1024 (src/syscall/abi.h:628), comfortably above the 500 threshold.
The bottleneck is the host process RLIMIT_NOFILE flowing into pipe(2).

Three places this could be fixed, in order of how localized:

  1. test-stress bumps RLIMIT_NOFILE itself before the FD-exhaustion subtest.
  2. elfuse bumps RLIMIT_NOFILE on the host before launching the guest.
  3. docs/testing.md Build Requirements documents the required ulimit -n.

Environment: Apple M3 Max MacBook Pro, macOS 26.5.1. kern.maxfilesperproc = 245760, zsh interactive ulimit -n =
1048576, but the effective limit visible to the guest is clearly lower (make check is invoked from a shell where the parent
limit isn't propagated as expected).

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