Opt-in owned tokio runtime for nodes without ambient executor#1748
Merged
phil-opp merged 1 commit intoApr 23, 2026
Merged
Conversation
Embedders that lack an ambient tokio runtime can now set DORA_CREATE_OWNED_TOKIO_RUNTIME=1 to have the node build its own multi-threaded runtime for the zenoh SHM data plane. Default remains strict: init errors when no runtime is available. Follow-up to #1745. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
@Mergifyio queue |
Contributor
Merge Queue Status
Waiting for:
All conditions
|
e2f5108
into
claude/apply-remaining-improvements-SMRpE
23 of 33 checks passed
phil-opp
added a commit
that referenced
this pull request
Apr 23, 2026
Node authors shouldn't have to set up a tokio runtime just to call `DoraNode::init_from_env()`. Drop the `DORA_CREATE_OWNED_TOKIO_RUNTIME` opt-in gate introduced in #1748 and always build an owned multi-threaded runtime when `Handle::try_current()` returns `Err`. Callers with an ambient runtime keep using it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
trunk-io Bot
pushed a commit
that referenced
this pull request
Apr 28, 2026
* refactor: remove DropToken system now that zenoh SHM is the data plane Continuation of #1741, salvaging more from the closed #1378. Zenoh's SHM provider now handles buffer lifecycle via its own reference counting, so the custom shmem + DropToken tracking path is pure legacy. - Node API: zenoh session + SHM provider are now mandatory in standard mode (no more DropStream fallback, no custom shmem allocation cache, no `DataSampleInner::Shmem`). `allocate_data_sample` always returns a heap buffer; zenoh publishes large payloads zero-copy. - Message types: removed `DataMessage::SharedMemory`, `DropToken`, `NodeDropEvent`, `DaemonReply::NextDropEvents`, the `SubscribeDrop` / `ReportDropTokens` / `NextFinishedDropTokens` requests, and `drop_tokens` on `NextEvent`. `DataMessage` is now just `Vec`. - DaemonCommunication::Shmem drops `daemon_drop_region_id`. - Daemon: removed `drop_channels`, `pending_drop_tokens`, `DropTokenInformation`, `check_drop_token`, the drop listener loop, and the SHM mmap+copy fan-out path (only `DataMessage::Vec` remains). - Dropped the `shared_memory_extended` dependency from dora-node-api. Nodes that were implicitly relying on the non-tokio fallback will now fail init with a clear error instead of silently degrading. * cleanup: remove dead SHM-protocol leftovers from message enums - DaemonReply::PreparedMessage: no construction or match sites remain after the SHM data-plane removal. - node_to_daemon::InputData: single-variant enum with no callers (the InputData used in integration tests comes from a different module). - Collapse the now-single-arm DataMessage match in the daemon into an irrefutable let. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Trigger CI * Opt-in owned tokio runtime for nodes without ambient executor (#1748) Support opt-in owned tokio runtime for nodes Embedders that lack an ambient tokio runtime can now set DORA_CREATE_OWNED_TOKIO_RUNTIME=1 to have the node build its own multi-threaded runtime for the zenoh SHM data plane. Default remains strict: init errors when no runtime is available. Follow-up to #1745. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Create owned tokio runtime by default when none is ambient Node authors shouldn't have to set up a tokio runtime just to call `DoraNode::init_from_env()`. Drop the `DORA_CREATE_OWNED_TOKIO_RUNTIME` opt-in gate introduced in #1748 and always build an owned multi-threaded runtime when `Handle::try_current()` returns `Err`. Callers with an ambient runtime keep using it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Carry ParamUpdate value as JSON bytes over the bincode wire `NodeEvent` is serialized with bincode on the daemon→node TCP channel. `serde_json::Value::deserialize` calls `Deserializer::deserialize_any`, which bincode does not support: the first `ParamUpdate` would kill the node's event stream with "Bincode does not support the serde::Deserializer::deserialize_any method". Change `NodeEvent::ParamUpdate.value` to `value_json: Vec<u8>` (JSON-encoded), and serialize/deserialize at the daemon and node boundaries. The public `Event::ParamUpdate.value: serde_json::Value` stays unchanged for callers. Adds a bincode round-trip regression test over representative JSON shapes so we don't slip a `deserialize_any` field back into `NodeEvent`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Fall back to heap publishes when zenoh SHM provider creation fails CI runners with a small `/dev/shm` (and tests that spawn many nodes in sequence without segment cleanup between runs) now hit `ShmProviderBuilder::default_backend` returning `OS error 12` (ENOMEM), which used to abort node init outright. Treat the SHM provider as best-effort instead: log a warning and proceed with `zenoh_shm_provider = None`. The send path already publishes via heap buffers when the provider is missing, so messages still flow — just without the SHM zero-copy fast path. Restores the contract-test suite that started failing once nodes actually reached the SHM allocation step (previously they failed earlier on tokio runtime init, masking the issue). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
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.
Follow-up to #1745. Embedders without an ambient tokio runtime can set
DORA_CREATE_OWNED_TOKIO_RUNTIME=1to haveDoraNode::initbuild a multi-threaded runtime for the zenoh SHM data plane. Default stays strict — init errors if no runtime is available.Depends on #1745 being merged first (this branch is based on it).