Skip to content

feat: add common transport-level handshake for RDMA and UBSHM - #47

Open
zchuango wants to merge 75 commits into
masterfrom
transport-handshake
Open

zchuango wants to merge 75 commits into
masterfrom
transport-handshake

Conversation

@zchuango

Copy link
Copy Markdown

No description provided.

Spicy-cream and others added 28 commits October 15, 2026 19:32
…lity

Resolve UBSHM handshake conflicts using the tested rebased tree. Retain backend-specific format negotiation, remote shared-memory lengths, and upstream IPC V2 tests.
Resolve current master conflicts and preserve UBSHM IPC V2 negotiation
Resolve master conflict and preserve shared memory name safety
…refresh

Resolve modular CMake conflict and preserve handshake protobuf generation
Retain the in-flight I/O delay and release the transaction synchronously when deferred cleanup cannot be scheduled. Unlink before handing cleanup ownership away and detach the closed ring from the transaction pool slot.

Cover timerfd creation failure in active and callback cleanup paths, including shared-memory release and repeated close. Validated 177 handshake/RDMA/UBSHM tests and 83 ASan tests.
Keep transaction slots until both the connection and cleanup callbacks release their references. Pin device-event lookups under the manager lock and route passive and timed-out closes through one cleanup owner.

Preserve UBS mapping metadata during unlink, reject non-positive cleanup delays, and complete the in-flight I/O wait after signal interruptions.

Validate with 182 handshake/RDMA/UBSHM tests, 88 ASan tests, and 10 repeated rounds of the three lifetime regression cases.
Spicy-cream and others added 30 commits November 9, 2026 23:10
* reject bare LF and CTLs in http chunk extensions

* test valid chunk extension as control before mutating it
* Support RDMA SRQ

* Fix socket reference ownership in RDMA test helpers

* Improve SRQ progress efficiency, receive handling, and failure isolation

* Update RDMA documents
…3755)

* test(butil): add unit test verifying cpu_relax uses isb on ARM64

Signed-off-by: James Lamb <admin@oranged.to>

* perf(butil): use isb instead of yield for cpu_relax on ARM64

Signed-off-by: James Lamb <admin@oranged.to>

---------

Signed-off-by: James Lamb <admin@oranged.to>
…el for Apple Silicon (apache#3764)

* fix(bazel): use @bazel_tools//src/conditions:darwin in test/BUILD.bazel

Signed-off-by: James Lamb <admin@oranged.to>

* fix(bazel): use @platforms//os:macos constraint in //bazel/config:darwin

Signed-off-by: James Lamb <admin@oranged.to>

---------

Signed-off-by: James Lamb <admin@oranged.to>
* Fix ObjectPool block item count race

* Fix object pool cleanup synchronization
* fix: bound InputMessenger non-protocol handlers

* Fix non-protocol handler capacity logging and test setup
* fix: preserve optional value lifetime

* Fix copy and move traits for C++14 optional

* Fix converting optional move semantics

* Fix optional swap noexcept specification
* fix(ubshm): reject truncated shared memory names

* test(ubshm): cover overlong peer names in server handshake

* fix(ubshm): preserve shared memory name logging
…port-protocol-name

# Conflicts:
#	src/brpc/ubshm/ub_endpoint.cpp
#	src/brpc/ubshm/ub_endpoint.h
* Support RDMA for FlatBuffers RPC

* Separate FlatBuffers RDMA tests from the default test suite

* Fix FlatBuffers RDMA allocation fallback and add CI coverage

* Fix RDMA memory deregistration during shutdown
…apache#3625)

* keep rejected lengthSizeMinusOne out of AVCDecoderConfigurationRecord

* parse AVCDecoderConfigurationRecord into a copy and commit on success
* Validate C1 before claiming a connection as rtmp

* Decide rtmp match from C1 version before C0+C1 is complete

---------

Co-authored-by: brpc-oncall <brpc-oncall@localhost>
* clear F_CHUNKED when a new Transfer-Encoding line starts

* clear F_CHUNKED at the Transfer-Encoding colon so empty values reset it
…3765)

* fix(ubshm): create ring segments with owner-only permissions

Ring segments were created with mode 0666, so any local user could open
and map an active connection's segments, whose names are predictable, and
then read or rewrite the payloads.

Create the segments with mode 0600 instead. Both the POSIX IPC backend and
the UBS backend now use a single SHM_SEGMENT_MODE constant, and the client
and the server are required to run as the same user.

Add a unittest that creates an IPC segment under a permissive umask, checks
that its permission bits are 0600, and verifies that a peer can still map
it. The UBS allocation depends on the external ubsm SDK, which is not
available in unit tests, so only the constant it passes to
ubsmem_shmem_allocate is checked.

* test(ubshm): check permissive umask case in a child process

umask is process-wide, so setting it to 0 in the test could widen the
permissions of a file created concurrently by a background thread. Fork a
child process for the permissive-umask check instead and keep the umask of
the test process untouched.

* test(ubshm): run the umask check in an exec'd process

Calling into the allocator in a child forked from the multithreaded test
process is unsafe: the child may inherit a mutex held by a thread that no
longer exists and deadlock, which also blocks the parent in waitpid.

Spawn the permissive-umask check as a fresh exec'd process instead. The
child is exec'd right after fork() and re-runs creates_owner_only_segment
with an env var that makes it set umask(0).

* docs(ubshm): note the same-user requirement applies to UBS too

UbsShmLocalMalloc passes the same 0600 creation mode to the ubsm SDK, so
processes that create and map a UBS segment must also run as the same
user. Document it and make the constant test spell out the implication.

Also terminate the executable path explicitly before execv(), since
butil::GetProcessAbsolutePath does not guarantee a NUL terminator.

---------

Co-authored-by: brpc-oncall <brpc-oncall@localhost>
* Fix ListOfABAFreeId::add() dropping new id after GC

* test: tighten EAGAIN check in AbaListTest.TestGcPreservesAddedIds
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.

8 participants