Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Too many open files when running static spec tests #40

@ensi321

Description

@ensi321

Description

When running static spec tests locally on Mac, I encounter error.ProcessFdQuotaExceeded. Looks like OS complains too many files are opened and there is no more fd available to open other files.

Attempted Fixes

  • Checked the code in test_case.zig and every openFile() call has defer File.close().
  • Have tried to increase the fd limit via ulimit but no avail.
  • Tried to find ways to limit the parallelization eg. maxWorkers flag in zig build but couldn't find any.

Suggestion

One way to mitigate this is to split the tests by fork instead of having one giant static_tests.zig housing all 31k tests, and run them in batches.

Log

nc@chainsafe ssz-z % zig build test:static_spec_tests -Dpreset=minimal
test:static_spec_tests
└─ run static_spec_tests 10234/31734 passed, 3 failed, 21497 skipped
error: 'static_tests.test.Static - bellatrix DepositData ssz_lengthy case_7' failed: /opt/homebrew/Cellar/zig/0.14.1/lib/zig/std/posix.zig:1824:23: 0x1028a88bb in openatZ (static_spec_tests)
            .MFILE => return error.ProcessFdQuotaExceeded,
                      ^
/opt/homebrew/Cellar/zig/0.14.1/lib/zig/std/fs/Dir.zig:886:16: 0x10289a23f in openFileZ (static_spec_tests)
    const fd = try posix.openatZ(self.fd, sub_path, os_flags, 0);
               ^
/opt/homebrew/Cellar/zig/0.14.1/lib/zig/std/fs/Dir.zig:833:5: 0x1028932ef in openFile (static_spec_tests)
    return self.openFileZ(&path_c, flags);
    ^
/Volumes/fast_boi/workspace/ssz-z/test/spec/test_case.zig:138:29: 0x102ac42a3 in validTestCase__anon_443602 (static_spec_tests)
    const serialized_file = try path.openFile("serialized.ssz_snappy", .{});
                            ^
/Volumes/fast_boi/workspace/ssz-z/test/spec/static_tests.zig:153534:5: 0x10303e643 in test.Static - bellatrix DepositData ssz_lengthy case_7 (static_spec_tests)
    try test_case.validTestCase(types.bellatrix.DepositData, allocator, test_dir, "roots.yaml");
    ^
error: 'static_tests.test.Static - bellatrix DepositData ssz_lengthy case_0' failed: /opt/homebrew/Cellar/zig/0.14.1/lib/zig/std/posix.zig:1824:23: 0x1028a88bb in openatZ (static_spec_tests)
            .MFILE => return error.ProcessFdQuotaExceeded,
                      ^
/opt/homebrew/Cellar/zig/0.14.1/lib/zig/std/fs/Dir.zig:886:16: 0x10289a23f in openFileZ (static_spec_tests)
    const fd = try posix.openatZ(self.fd, sub_path, os_flags, 0);
               ^
/opt/homebrew/Cellar/zig/0.14.1/lib/zig/std/fs/Dir.zig:833:5: 0x1028932ef in openFile (static_spec_tests)
    return self.openFileZ(&path_c, flags);
    ^
/Volumes/fast_boi/workspace/ssz-z/test/spec/test_case.zig:123:24: 0x102ac3f1b in validTestCase__anon_443602 (static_spec_tests)
    const value_file = try path.openFile("value.yaml", .{});
                       ^
/Volumes/fast_boi/workspace/ssz-z/test/spec/static_tests.zig:153549:5: 0x10303e853 in test.Static - bellatrix DepositData ssz_lengthy case_0 (static_spec_tests)
    try test_case.validTestCase(types.bellatrix.DepositData, allocator, test_dir, "roots.yaml");
    ^
error: 'static_tests.test.Static - bellatrix DepositData ssz_lengthy case_9' failed: /opt/homebrew/Cellar/zig/0.14.1/lib/zig/std/posix.zig:1824:23: 0x1028a88bb in openatZ (static_spec_tests)
Unable to dump stack trace: ProcessFdQuotaExceeded
error: while executing test 'static_tests.test.Static - electra DepositMessage ssz_random case_12', the following test command failed:
/Volumes/fast_boi/workspace/ssz-z/.zig-cache/o/2e0ac11549a178c733160ca070903c11/static_spec_tests --seed=0xd0300fb8 --cache-dir=/Volumes/fast_boi/workspace/ssz-z/.zig-cache --listen=- 
Build Summary: 4/6 steps succeeded; 1 failed; 10234/31734 tests passed; 21497 skipped; 3 failed
test:static_spec_tests transitive failure
└─ run static_spec_tests 10234/31734 passed, 3 failed, 21497 skipped
error: the following build command failed with exit code 1:

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