Skip to content

cmake build test error on macOS #3058

Closed

Description

@leafok88

During build / test from source (version 3.3.6) with CMake on macOS, 1 of 33 tests failed. The error message was as below.

32/33 Test #34: test_event .......................Subprocess aborted***Exception: 0.01 sec
Assertion failed: (bind(fd, (struct sockaddr *)&address, sizeof(address)) == 0), function main, file test_event.c, line 56.

  Start 35: test_resolv_async

97% tests passed, 1 tests failed out of 33

The following tests FAILED:
34 - test_event (Subprocess aborted) unit
Errors while running CTest

The command executed:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel
ctest --test-dir build -L 'unit|vendor' --output-on-failure

Testing environment:
cmake version 4.4.3
Darwin Kernel Version 25.6.0: arm64

Activity

  1. madeye commented on Sep 12, 2026

    @madeye
    Contributor

    Thanks for the report. This is caused by macOS's default per-process file descriptor limit rather than a bug in the event loop.

    test_event deliberately opens 256 UDP sockets (to exceed Winsock's 64-descriptor select() limit) plus a sender socket and the loop's own kqueue descriptor. A stock macOS Terminal session starts with a soft limit of 256 (ulimit -n prints 256), so socket() starts returning -1 near the end of that loop and the unchecked descriptor trips the bind() assertion you saw. Running with a higher limit already makes the test pass on 3.3.6:

    ulimit -n 1024
    ctest --test-dir build -L 'unit|vendor' --output-on-failure

    #3060 fixes this properly: CTest now raises the soft limit to 1024 before launching each unit test, test_event raises its own limit when run directly, and a socket() failure is now reported as such instead of as a bind() failure.

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