Repository navigation
Conversation
Add arknet_poll_connection_control, a POSIX peer without Asio or strands that speaks the native control's wire protocol. It can use poll(2) or an Asio-like kqueue loop, reproduce the native control's serialized read and write cadence and socket setup, and report stalled kernel send queues with Apple TCP_CONNECTION_INFO. Add --session-strands, --write-buffers and --io-histogram to the native Asio control; defaults keep its existing behavior. Document both tools. These controls separate Asio-specific behavior from the transport in #61. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 10, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Diagnostic tools for the 5,000-connection loopback stall in #61. Default behavior of every existing tool is unchanged.
arknet_poll_connection_control(new, POSIX only,benchmarks/poll_connections.cpp): a single-thread TCP peer without Asio or strands that speaks the native Asio control's wire protocol, so either role can be paired witharknet_asio_connection_control.--events poll|kqueue:poll(2), or on Apple/BSD a loop that registers events the way the Boost.Asio kqueue reactor does.--write-pacing burst|serial,--read-pacing drain|serial: reproduce the native control's serializedasync_writeand one-frame-per-completionasync_read_untilcadence.--socket-setup default|asio:SO_NOSIGPIPEandioctl(FIONBIO)as in Boost.Asiosocket_ops.--send-queue-watch on: reports kernel send queues unchanged for one second, with AppleTCP_CONNECTION_INFO.resultevent recording every mode.arknet_asio_connection_control:--session-strands on|off,--write-buffers split|joinedand--io-histogram off|on. The default write path keeps its two-bufferstd::array;--io-histogramcannot be combined with--socket-operation-trace.connections_io_histogram.hpp(new) and anio_count_streamwrapper inconnections_socket_trace.hppthat preserves handler associations like the existing trace wrapper.benchmark_poll_connections_helpandbenchmark_poll_connections_self_teston Unix.benchmarks/CONNECTIONS.md,CONNECTIONS_CN.mdand the testing tables indocs/project/testing*.mddescribe the tools.Why
#61 had no way to separate Asio-specific behavior from the transport. With these controls, same-host comparisons showed that a non-Asio peer can reproduce the stall, that it appears only at 5,000 connections, and that it coincides with lost loopback packets and retransmission. The measurements and their limits are in the 2026-11-09 comment. This PR does not fix #61 and makes no capacity claim.
Validation
Local, macOS 27.0.1 (26A434) arm64, Apple clang 17.0.0, Boost 1.92.0, Release, TLS off, at the head of this PR:
cmake -G Ninja -DARKNET_BUILD_BENCHMARKS=ON -DARKNET_BUILD_TESTS=ONwithARKNET_CHECK_TESTSset to the 14 connection checks, thencmake --build ... --target arknet_check: all passed —connection_kernel_samples,benchmark_connections_help,connection_load_protocol,connection_load_resources,benchmark_connections_backpressure,benchmark_asio_connections_help,benchmark_asio_connections_self_test(now also covering the three new switches and the double-wrap rejection),connection_operation_trace,connection_socket_operation_trace,benchmark_poll_connections_help,benchmark_poll_connections_self_test(four event/pacing combinations),benchmark_asio_socket_observer,benchmark_asio_connections_processes,connection_socket_observer.poll_connections.cppcompiles without warnings under-Wall -Wextra -Wpedantic -Wshadow -Wconversion.node --test tests/ci/*.test.mjs: 93 passed, 1 skipped, 0 failed;node --test docs/site/scripts/ci-scope.test.mjs: 6 passed.docs/sitedependencies are not installed here).Limits
scripts/format_spacing.sh; clang-format 18 is verified by CI.--events kqueue,--socket-setup asio'sSO_NOSIGPIPEandtcp_infoapply on Apple/BSD; elsewhere the self-test runs thepoll(2)combinations andtcp_inforeportsunsupported.🤖 Generated with Claude Code