Skip to content

Commit d34eb3e

Browse files
committed
[fix] CI: 修复 WebSocket 空闲超时测试竞态 + GitHub Actions io_uring 封禁
1. test_websocket: server.stop() 前轮询等待 onDisconnect 完成, 消除 sanitizer 构建下 ioContext_.stop() 抢占回调的竞态 2. CMake: 新增 HICAL_DISABLE_IO_URING 选项(默认 OFF) 3. ci.yml: Linux 构建传入 -DHICAL_DISABLE_IO_URING=ON, 因 GitHub Actions 自 2025-04 起 seccomp 封禁 io_uring syscall, Boost 1.83 的 random_access_file 无线程池 fallback 导致 ENOMEM
1 parent 5049762 commit d34eb3e

2 files changed

Lines changed: 17 additions & 7 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ jobs:
6363
-DCMAKE_C_COMPILER=${{ matrix.cc }} \
6464
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \
6565
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
66-
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
66+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
67+
-DHICAL_DISABLE_IO_URING=ON
6768
6869
- name: Build (Linux)
6970
if: runner.os == 'Linux' && matrix.compiler != 'clang'
@@ -83,7 +84,8 @@ jobs:
8384
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
8485
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
8586
-DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer" \
86-
-DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address,undefined"
87+
-DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address,undefined" \
88+
-DHICAL_DISABLE_IO_URING=ON
8789
8890
- name: Build with sanitizers (Clang)
8991
if: matrix.compiler == 'clang'
@@ -109,7 +111,8 @@ jobs:
109111
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \
110112
-DCMAKE_CXX_FLAGS="--coverage" \
111113
-DCMAKE_C_FLAGS="--coverage" \
112-
-DCMAKE_EXE_LINKER_FLAGS="--coverage"
114+
-DCMAKE_EXE_LINKER_FLAGS="--coverage" \
115+
-DHICAL_DISABLE_IO_URING=ON
113116
cmake --build build-cov -j$(nproc)
114117
115118
- name: Run tests for coverage

src/CMakeLists.txt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,18 @@ if(WIN32)
5555
endif()
5656

5757
# Linux 需要链接 liburing(Boost.Asio random_access_file 依赖 io_uring)
58+
# GitHub Actions 自 2025-04 起封禁 io_uring syscall,CI 中需 -DHICAL_DISABLE_IO_URING=ON
5859
if(UNIX AND NOT APPLE)
59-
find_library(URING_LIB uring)
60-
if(URING_LIB)
61-
target_link_libraries(hical_core PRIVATE ${URING_LIB})
62-
target_compile_definitions(hical_core PUBLIC BOOST_ASIO_HAS_IO_URING)
60+
option(HICAL_DISABLE_IO_URING "Disable io_uring backend (for environments where io_uring is blocked)" OFF)
61+
62+
if(NOT HICAL_DISABLE_IO_URING)
63+
find_library(URING_LIB uring)
64+
if(URING_LIB)
65+
target_link_libraries(hical_core PRIVATE ${URING_LIB})
66+
target_compile_definitions(hical_core PUBLIC BOOST_ASIO_HAS_IO_URING)
67+
endif()
68+
else()
69+
message(STATUS "io_uring disabled via HICAL_DISABLE_IO_URING")
6370
endif()
6471
endif()
6572

0 commit comments

Comments
 (0)