Skip to content

fix(buffer)!: transfer receive storage with move-only ownership - #164

Merged
nick2781 merged 32 commits into
mainfrom
fix/buffer-ownership
Oct 26, 2026
Merged

nick2781 merged 32 commits into
mainfrom
fix/buffer-ownership

Conversation

@nick2781

@nick2781 nick2781 commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

The receive buffer owns an allocated array but previously allowed implicit shallow copies, which could release the same storage twice. Make ark::buffer explicitly move-only with RAII, noexcept transfers and a reusable empty moved-from state. Existing Net sessions are already noncopyable; no tracked caller requires buffer copying.

Preserve capacity defaults, logical header paths and throwing allocation behavior. Constructor, growth and release now use a matched customization-hook pair. Failed growth preserves existing data/state; zero/null writes and removal bounds have explicit behavior. A small private capacity-preparation path keeps cleanup machinery out of steady writes without removing checks. English/Chinese references document migration and borrowing boundaries.

Local acceptance at 6697839 passed: Core Debug, 13 focused ownership/failure/hook cases, Release, AddressSanitizer and UndefinedBehaviorSanitizer (leak detection off), six existing Net framing cases, clang-format 18 and actual bilingual HTML/Markdown. CI/docs contracts passed on the ownership revision; the subsequent refinement only changes the private buffer header. Synchronization with accepted main #163 preserves the complete tested tree; fresh hosted source and full-candidate acceptance remain required.

The unchanged permanent C++ framing benchmark was compared locally on an M4 Pro/macOS27.0.1, Release AppleClang21, one process/thread, 1/4KiB payloads, batches1/16, three repeats per revision/case, 24 runs. Final median throughput was 1.62–3.21% above its contemporaneous baseline with identical allocation counts/bytes and session size. Three short samples do not establish a universal speedup, network throughput or capacity. An initial approximately4% loss was retained locally and followed by exactly one code-layout refinement and comparison. Raw measurements remain local. Local arknet64c8 is an override, not CI's pinned source.

BREAKING CHANGE: ark::buffer no longer supports implicit copying and its private representation changes. Move ownership or explicitly copy readable bytes into independent storage; rebuild affected Core/Net consumers and plugins together. Existing standalone and Net initial-capacity defaults are unchanged.

Full candidate 40295194385 exposed an existing macOS launcher-test timing dependency: the native-readiness case spent its 50 ms deadline retiring managed tasks and reported the wrong expected phase. Commit d310173 isolates that case with an empty task group and a held native worker; other cases retain the complete task/callback/native-thread retirement sequence. The deadline, exact zero-pending readiness diagnostic, failure retention and late-completion latch assertions remain required. The corrected real-launcher stop cases, all 24 startup-failure children, 157 CI policy checks and clang-format 18 passed locally using CI's exact arknet pin. The first local startup run was sandbox-blocked at loopback bind; the authorized native run passed. This is a test correction, not a production shutdown or TCP timeout fix.

nick2781 and others added 30 commits October 26, 2026 09:25
Replace Consul creation macros with typed bases, a private owning factory and explicit DLL entry points. Preserve interface registration, disabled updates and request behavior, and add construction/lifecycle checks with bilingual migration guidance.

BREAKING CHANGE: Consul implementation and plugin class layouts change. Rebuild Consul and its consumers together; all existing public types and logical header paths remain available.
Read hash blocks and write digest bytes without alignment or aliasing assumptions. Use C++20 rotations and provide explicit legacy MSVC methods for persisted-key migration.

BREAKING CHANGE: default MurmurHash3 now uses canonical little-endian blocks and output. Old MSVC IDs, shard mappings and persisted keys require an explicit migration or the matching legacy MSVC method.
Bumps [fast-uri](https://github.com/fastify/fast-uri) from 3.1.8 to 3.1.9.
- [Release notes](https://github.com/fastify/fast-uri/releases)
- [Commits](fastify/fast-uri@v3.1.8...v3.1.9)

---
updated-dependencies:
- dependency-name: fast-uri
  dependency-version: 3.1.9
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
# Conflicts:
#	docs/reference/utility.md
#	docs/reference/utility_CN.md
#	src/core/hash/murmur_hash.hpp
#	tests/core/README.md
#	tests/core/README_CN.md
Use typed module and plugin bases with a private interface-returning factory and explicit entry points. Retain every public header, default plugin selection and existing Etcd request implementation. Add factory, ownership and production DSO checks to Applications acceptance.

BREAKING CHANGE: etcd_client_module_impl and etcd_client_plugin have changed public class layouts. Rebuild Etcd Client and all consumers together; existing interfaces and logical header paths remain available.
Resolve the duplicated Consul history by retaining the preceding integration tree plus the exact Etcd feature delta. Preserve the independent hash-header check, codec cleanup and all typed plugin construction coverage.
Check a successful live-listener negative control, retain the exercised TCP peer across manager shutdown, and require a remote EOF or reset before stopping that peer. Check listener closure using an exact refused new connection instead of global immediate port rebinding.

Keep existing endpoint ownership, manager state, main-thread callbacks and pending HTTP cancellation assertions. The original macOS CI bind conflict holder was not reproduced locally; no production shutdown or reuse-address behavior changes.
Use a private io_context, async_connect and the existing five-second deadline. Cancel and close the probe socket on expiry, return typed timed_out rather than operation_aborted, and drain connect and timer callbacks before returning.

Keep all live-listener, retained-peer and owner-state assertions and the existing test timeout. Production shutdown remains unchanged.
Retain public OSS SDK headers and types while replacing creation macros with
module_base, an interface-returning private factory, plugin_base and explicit
entry points. Replace the undefined deregistration call with typed owned
unregistration while preserving the interface key and disabled updates.

Add real-factory assembly and controlled DSO lifecycle regressions, production
export checks and bilingual migration guidance. Keep the optional plugin off by
default and retain its TODO capability boundary.

BREAKING CHANGE: oss_sdk_module_impl and oss_sdk_plugin change public class
layouts. Rebuild OSS SDK and all affected consumers together; original public
header paths, types and the oss_sdk_module interface remain available.
Use typed module/plugin bases, a private interface-returning factory and explicit DLL entries while preserving enabled updates and RdKafka callback inheritance. Add real factory/assembly, controlled lifecycle and production export checks. Cast callback log enums to integers for current fmt compatibility.

BREAKING CHANGE: Kafka implementation and plugin public class layouts change. Rebuild Kafka and its C++ consumers together; retained public headers, interface keys and producer behavior remain available.
Retain both typed module migrations, their public header contracts and independent disabled/enabled update selections. Preserve original production and permanent test sources while resolving shared bilingual guidance and core test wiring.
Own the receive array with a private unique_ptr deleter, prohibit shallow copies
and transfer allocation/cursor state through noexcept moves. Leave moved-from
buffers empty and reusable, preserve self-move, capacity growth and throwing
allocation behavior, and route growth through matching configured array hooks.

Reject out-of-range consumption and avoid null-pointer operations for empty
writes and storage. Add permanent ownership, framing-state, deterministic
allocation-failure and isolated custom-hook regressions with bilingual guidance.

BREAKING CHANGE: ark::buffer no longer supports copy construction or copy
assignment and its private storage representation changes. Use explicit moves
for ownership transfer and rebuild affected Core/Net consumers and plugins
together. Define compatible ARK_NEW_ARRAY/ARK_DELETE_ARRAY overrides consistently;
growth now uses the same hook pair as construction and destruction.
Move compaction and growth preparation into a private helper behind the C++20
unlikely branch for insufficient tail space. Keep allocation and exception
handling off the steady receive-write path without changing any ownership,
bounds, hook or failure contract.

AppleClang Release disassembly moves grow out of the framing loop and reduces
the local benchmark's parse_frames body from 335 to 270 instructions. The
bounded timing comparison remains separate evidence and is retained locally.
@nick2781
nick2781 added this pull request to the merge queue Oct 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 26, 2026
@nick2781
nick2781 added this pull request to the merge queue Oct 26, 2026
Merged via the queue into main with commit d9f746b Oct 26, 2026
6 checks passed
@nick2781
nick2781 deleted the fix/buffer-ownership branch October 26, 2026 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant