Skip to content

Feature/per client replies - #49

Merged
SoleyRan merged 6 commits into
mainfrom
feature/per-client-replies
Oct 30, 2026
Merged

SoleyRan merged 6 commits into
mainfrom
feature/per-client-replies

Conversation

@SoleyRan

Copy link
Copy Markdown
Owner

No description provided.

SoleyRan and others added 6 commits October 29, 2026 11:56
With BUILD_SHARED_LIBS=ON on Linux and macOS, the installed tools had
no RUNPATH and failed to load libpuppet_master*.so unless
LD_LIBRARY_PATH pointed at the install. Installed binaries now carry
$ORIGIN/../lib and installed libraries $ORIGIN (@loader_path on
macOS), so an install works from any prefix, also after moving it.
Only set when PuppetMaster is the top-level project and
CMAKE_INSTALL_RPATH is not already defined.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Scheduled servers, asynchronous calls, the system launcher, the topic
tool, and recordings. The soname becomes libpuppet_master.so.0.3 and
the package accepts only 0.3.x, because TriggerSpec and NodeManifest
gained fields. The shm layout, the service wire protocol, and 0.2 JSON
configurations are unchanged, so 0.2 and 0.3 processes interoperate.

The vehicle pipeline example now asks for PuppetMaster 0.3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The in-memory and shm transports kept every topic they ever opened in a
map of strong references, and FastDDS kept every DDS topic in the
participant, until the transport closed. A process that opens many
short-lived topics, as a server with per-client reply topics will,
grew without bound.

Endpoints now own their topic and the transports only find it: in
memory the channel is freed, in shm the segment is unmapped and the
participant entry released, and in FastDDS the DDS topic is deleted,
once no reader or writer in this process uses it. Expired entries are
swept when the next endpoint is created.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
TopicSpec::lifetime kReaderOwned gives a topic to its one reader, as a
service client's reply topic will be. The reader creates it; writers
only attach and fail with NotFound when the reader never created it or
has closed it. In shared memory the closing reader sets a new retired
flag in the segment header (the reserved word, so the layout version
is unchanged), wakes attached writers, and removes the segment name.
When a reader crashes, the last writer to close, seeing no live
process attached, removes the name, so no segment is left behind.
FastDDS treats the lifetime as shared: it leaves nothing behind and
cannot tell a missing reader from an undiscovered one.

shm::Options::topic_prefixes sizes every topic under a name, and a
service's deployment settings now also cover `<service>/reply/`.

Two shm tests dropped a writer right after creating it and expected
the topic to stay; since topics are released with their last endpoint
(and on Windows the segment with its last handle), they hold it now.
Found by running the test natively on Windows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every client used to read one shared reply topic and drop the replies
meant for others, so with N clients each reply was delivered N times,
and a busy client could push other clients' replies out of a shared
queue. Each client now reads `<service>/reply/<client id in 16 hex
digits>`, a reader-owned topic it creates and removes on Close.

The server opens a writer per client on its first reply, through the
transport directly (not the runtime, so per-client topics add no
metrics series and the server holds what it writes through). On
FastDDS it waits for the new writer to match, at most 1 s or until the
request's deadline, once per client. A reply that cannot reach its
client (closed, or never matched) is dropped and the client times out.
The heartbeat thread closes writers idle for
ServerOptions::reply_idle_timeout (30 s), which lets shm remove the
reply segment of a client that crashed.

Wire protocol 2: the header version is 2, and the presence type is
service.Presence.v2 v2, so 0.3 and newer processes do not see each
other's heartbeats and a mixed call fails with Unavailable instead of
timing out. Client::Close now also releases the reply reader.

Adds RuntimeContext::FindTransport(TransportKind) and
service::ReplyEndpointFor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@SoleyRan SoleyRan self-assigned this Oct 30, 2026
@SoleyRan
SoleyRan merged commit 55dc3f7 into main Oct 30, 2026
18 checks passed
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