From 786516e61d9a64b81b62e1038a82bacf70964560 Mon Sep 17 00:00:00 2001 From: Viacheslav Shalygin <96007284+vshalygin@users.noreply.github.com> Date: Tue, 1 Sep 2026 19:32:15 +0300 Subject: [PATCH 1/2] Set default ninja version 1.11.1.1 --- README.md | 2 +- docker/linux-clang-x64.Dockerfile | 6 ++++-- docker/linux-clang-x86.Dockerfile | 6 ++++-- docker/linux-gcc-x64.Dockerfile | 5 +++-- docker/linux-gcc-x86.Dockerfile | 6 ++++-- docs/build-and-install.md | 6 +++--- docs/getting-started.md | 12 +++++++----- 7 files changed, 26 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 2a4c6e2c..063a17f0 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ is built as a standalone project and consumes the installed package through custom builds. - [vcpkg](https://github.com/microsoft/vcpkg), bootstrapped locally, required for the provided presets. -- Ninja for the provided Linux presets. +- Ninja 1.10.2 or newer for the provided Linux presets. - A multilib toolchain and 32-bit development libraries for Linux x86 builds. - Python 3 and gcovr 8.6 for coverage generation. diff --git a/docker/linux-clang-x64.Dockerfile b/docker/linux-clang-x64.Dockerfile index 3fb49d9f..bbbf389f 100644 --- a/docker/linux-clang-x64.Dockerfile +++ b/docker/linux-clang-x64.Dockerfile @@ -4,6 +4,7 @@ FROM ubuntu:22.04 ARG DEBIAN_FRONTEND=noninteractive ARG CMAKE_VERSION=4.4.2 +ARG NINJA_VERSION=1.11.1.1 ARG VCPKG_COMMIT=6f29f12e82a8293156836ad81cc9bf5af41fe836 RUN apt-get update \ @@ -15,7 +16,6 @@ RUN apt-get update \ git \ lld \ llvm \ - ninja-build \ pkg-config \ python3 \ python3-pip \ @@ -24,7 +24,9 @@ RUN apt-get update \ zip \ && rm -rf /var/lib/apt/lists/* -RUN python3 -m pip install --no-cache-dir "cmake==${CMAKE_VERSION}" +RUN python3 -m pip install --no-cache-dir \ + "cmake==${CMAKE_VERSION}" \ + "ninja==${NINJA_VERSION}" RUN git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg \ && git -C /opt/vcpkg checkout --detach "${VCPKG_COMMIT}" \ diff --git a/docker/linux-clang-x86.Dockerfile b/docker/linux-clang-x86.Dockerfile index 2aa6ee1f..a81a7899 100644 --- a/docker/linux-clang-x86.Dockerfile +++ b/docker/linux-clang-x86.Dockerfile @@ -4,6 +4,7 @@ FROM ubuntu:22.04 ARG DEBIAN_FRONTEND=noninteractive ARG CMAKE_VERSION=4.4.2 +ARG NINJA_VERSION=1.11.1.1 ARG VCPKG_COMMIT=6f29f12e82a8293156836ad81cc9bf5af41fe836 RUN apt-get update \ @@ -17,7 +18,6 @@ RUN apt-get update \ git \ lld \ llvm \ - ninja-build \ pkg-config \ python3 \ python3-pip \ @@ -26,7 +26,9 @@ RUN apt-get update \ zip \ && rm -rf /var/lib/apt/lists/* -RUN python3 -m pip install --no-cache-dir "cmake==${CMAKE_VERSION}" +RUN python3 -m pip install --no-cache-dir \ + "cmake==${CMAKE_VERSION}" \ + "ninja==${NINJA_VERSION}" RUN git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg \ && git -C /opt/vcpkg checkout --detach "${VCPKG_COMMIT}" \ diff --git a/docker/linux-gcc-x64.Dockerfile b/docker/linux-gcc-x64.Dockerfile index 42947c7c..187ee5f7 100644 --- a/docker/linux-gcc-x64.Dockerfile +++ b/docker/linux-gcc-x64.Dockerfile @@ -5,6 +5,7 @@ FROM ubuntu:22.04 ARG DEBIAN_FRONTEND=noninteractive ARG CMAKE_VERSION=4.4.2 ARG GCOVR_VERSION=8.6 +ARG NINJA_VERSION=1.11.1.1 ARG VCPKG_COMMIT=6f29f12e82a8293156836ad81cc9bf5af41fe836 RUN apt-get update \ @@ -13,7 +14,6 @@ RUN apt-get update \ ca-certificates \ curl \ git \ - ninja-build \ pkg-config \ python3 \ python3-pip \ @@ -24,7 +24,8 @@ RUN apt-get update \ RUN python3 -m pip install --no-cache-dir \ "cmake==${CMAKE_VERSION}" \ - "gcovr==${GCOVR_VERSION}" + "gcovr==${GCOVR_VERSION}" \ + "ninja==${NINJA_VERSION}" RUN git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg \ && git -C /opt/vcpkg checkout --detach "${VCPKG_COMMIT}" \ diff --git a/docker/linux-gcc-x86.Dockerfile b/docker/linux-gcc-x86.Dockerfile index ff6c3bf6..1ff4fad0 100644 --- a/docker/linux-gcc-x86.Dockerfile +++ b/docker/linux-gcc-x86.Dockerfile @@ -4,6 +4,7 @@ FROM ubuntu:22.04 ARG DEBIAN_FRONTEND=noninteractive ARG CMAKE_VERSION=4.4.2 +ARG NINJA_VERSION=1.11.1.1 ARG VCPKG_COMMIT=6f29f12e82a8293156836ad81cc9bf5af41fe836 RUN apt-get update \ @@ -14,7 +15,6 @@ RUN apt-get update \ g++-multilib \ gcc-multilib \ git \ - ninja-build \ pkg-config \ python3 \ python3-pip \ @@ -23,7 +23,9 @@ RUN apt-get update \ zip \ && rm -rf /var/lib/apt/lists/* -RUN python3 -m pip install --no-cache-dir "cmake==${CMAKE_VERSION}" +RUN python3 -m pip install --no-cache-dir \ + "cmake==${CMAKE_VERSION}" \ + "ninja==${NINJA_VERSION}" RUN git clone https://github.com/microsoft/vcpkg.git /opt/vcpkg \ && git -C /opt/vcpkg checkout --detach "${VCPKG_COMMIT}" \ diff --git a/docs/build-and-install.md b/docs/build-and-install.md index ebcdff41..0f9e25d3 100644 --- a/docs/build-and-install.md +++ b/docs/build-and-install.md @@ -39,8 +39,8 @@ Every build requires: - platform thread support. GoogleTest is required only when `BUILD_TESTING=ON`. The recommended Linux -presets use Ninja. Linux x86 builds additionally require a multilib compiler -and 32-bit system development libraries. +presets use Ninja 1.10.2 or newer. Linux x86 builds additionally require a +multilib compiler and 32-bit system development libraries. The current CI toolchains are MSVC v143, GCC 11, and Clang 14. These versions define the continuously tested configurations, not a hard requirement for a @@ -369,7 +369,7 @@ architectures, standard-library ABIs, or MSVC runtime models. - Confirm that `VCPKG_ROOT` is set in the environment visible to CMake or the IDE, not only in a different terminal session. -- Install Ninja before selecting a provided Linux preset. +- Install Ninja 1.10.2 or newer before selecting a provided Linux preset. - Use a fresh build directory after changing the compiler, generator, architecture, toolchain, or vcpkg triplet. - Ensure the package architecture and configuration match the consumer. diff --git a/docs/getting-started.md b/docs/getting-started.md index f5112c5b..cc751b87 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -122,7 +122,7 @@ distribution. Package names may differ on other distributions. ### 1. Install the tools -Install the compiler, Ninja, Git, Python, and the utilities needed by vcpkg: +Install the compiler, Git, Python, and the utilities needed by vcpkg: ```bash sudo apt-get update @@ -131,7 +131,6 @@ sudo apt-get install --yes \ ca-certificates \ curl \ git \ - ninja-build \ pkg-config \ python3 \ python3-pip \ @@ -140,11 +139,14 @@ sudo apt-get install --yes \ zip ``` -Ubuntu 22.04 provides an older CMake than this project requires. One way to -install a sufficiently recent user-local version is: +Ubuntu 22.04 provides older CMake and Ninja versions than the recommended +project setup. Install the same versions used by the Linux toolchain images in +the user-local Python binary directory: ```bash -python3 -m pip install --user "cmake==4.4.2" +python3 -m pip install --user \ + "cmake==4.4.2" \ + "ninja==1.11.1.1" export PATH="$HOME/.local/bin:$PATH" ``` From 6e6fdfb6e685e1b8589f11c5155163e71113c9cd Mon Sep 17 00:00:00 2001 From: Viacheslav Shalygin <96007284+vshalygin@users.noreply.github.com> Date: Tue, 1 Sep 2026 19:51:11 +0300 Subject: [PATCH 2/2] Fix regress --- .../pipe/tcp-pipe/tcp-pipe-endpoint.cpp | 46 +++++++++++++++---- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/rpc-lib/rpc-lib/pipe/tcp-pipe/tcp-pipe-endpoint.cpp b/rpc-lib/rpc-lib/pipe/tcp-pipe/tcp-pipe-endpoint.cpp index d6ae017e..f7b2a536 100644 --- a/rpc-lib/rpc-lib/pipe/tcp-pipe/tcp-pipe-endpoint.cpp +++ b/rpc-lib/rpc-lib/pipe/tcp-pipe/tcp-pipe-endpoint.cpp @@ -228,11 +228,13 @@ namespace vshalygin::rpc { void invalidate_unsafe(bool by_cancel); - void start_write_header_async(); + void start_write_header_async( + std::vector &pending_results); void start_write_payload_async( std::vector &pending_results); - void start_read_header_async(); + void start_read_header_async( + std::vector &pending_results); void start_read_payload_async( std::vector &pending_results); @@ -338,6 +340,7 @@ namespace vshalygin::rpc { assert(msg.size() != 0); write_future future; + std::vector pending_results; bool is_connected; { cl::ordered_lock guard(m_write_mtx, m_socket_mtx); @@ -379,11 +382,13 @@ namespace vshalygin::rpc { std::move(msg), std::move(promise), id, timer_id); if(m_write_operations.size() == 1) { - start_write_header_async(); + start_write_header_async(pending_results); } } } + publish_results(pending_results); + if(!is_connected) { return write_future(m_thread_pool, pipe_op_res::failed); } @@ -393,6 +398,7 @@ namespace vshalygin::rpc { read_future tcp_pipe_endpoint::impl::read_async(const std::optional &timeout) { read_future future; + std::vector pending_results; bool is_connected; { cl::ordered_lock guard(m_read_mtx, m_socket_mtx); @@ -434,21 +440,32 @@ namespace vshalygin::rpc { m_read_operations.emplace_front(std::move(promise), id, timer_id); if(m_read_operations.size() == 1) { - start_read_header_async(); + start_read_header_async(pending_results); } } } + publish_results(pending_results); + if(!is_connected) { return read_future(m_thread_pool, cl::ftuple(pipe_op_res::failed, cl::buffer{})); } return future; } - void tcp_pipe_endpoint::impl::start_write_header_async() + void tcp_pipe_endpoint::impl::start_write_header_async( + std::vector &pending_results) { assert(!m_write_operations.empty()); - assert(m_socket.is_open()); + + if(!m_socket.is_open()) { + auto r = m_was_invalidated_by_fail + ? pipe_op_res::failed + : pipe_op_res::canceled; + complete_all_operations_unsafe( + r, m_write_operations, pending_results); + return; + } m_socket.async_write_some(m_write_operations.back().op.get_unwritten_header_buffer(), [self = shared_from_this()](const boost::system::error_code &ec, @@ -485,10 +502,19 @@ namespace vshalygin::rpc { }); } - void tcp_pipe_endpoint::impl::start_read_header_async() + void tcp_pipe_endpoint::impl::start_read_header_async( + std::vector &pending_results) { assert(!m_read_operations.empty()); - assert(m_socket.is_open()); + + if(!m_socket.is_open()) { + auto r = m_was_invalidated_by_fail + ? pipe_op_res::failed + : pipe_op_res::canceled; + complete_all_operations_unsafe( + r, m_read_operations, pending_results); + return; + } m_socket.async_read_some(m_read_operations.back().op.get_buffer_for_unread_header(), [self = shared_from_this()](const boost::system::error_code &ec, @@ -563,7 +589,7 @@ namespace vshalygin::rpc { } } else { if(!op.is_header_completed()) { - (this->*start_header_op_async)(); + (this->*start_header_op_async)(pending_results); } else { (this->*start_payload_op_async)(pending_results); } @@ -617,7 +643,7 @@ namespace vshalygin::rpc { operations.pop_back(); if(!operations.empty()) { - (this->*start_header_op_async)(); + (this->*start_header_op_async)(pending_results); } } }