Skip to content

[Doc] SimpleStorageUnit ZMQ Multipart Framing, Silent Request Loss, and Fault Isolation #230

Todo

Description

@0oshowero0

TL;DR
PR #228 removes the internal ROUTER <-> proxy_thread <-> inproc DEALER forwarding layer in SimpleStorageUnit so its single worker_thread polls and serves the bound TCP ROUTER socket directly. Beyond removing two ZMQ hops per request and a hardcoded 0.5s startup sleep, this refactoring eliminates two subtle reliability hazards: (1) pre-send errors on one request closing the inproc:// socket and silently destroying concurrent peers' queued requests, and (2) mid-SNDMORE reply failures misrouting subsequent replies across clients. This document records the wire invariants, failure mechanics, rejected recovery designs, and observability boundaries across related PRs for future maintainers.

Related PRs: #143, #145, #167, #168, #171, #172, #192, #201, #204, #214, #228


1. Underlying Wire Invariant: The ZMQ ROUTER Multipart Contract

SimpleStorageUnit serves multiple AsyncSimpleStorageManager peers (DEALER sockets) over a single bound TCP ROUTER socket (put_get_socket). Two libzmq / ZMTP 3.x rules govern every failure mode on this path:

  1. Sender-side SNDMORE envelope rule: When a ROUTER sends a multipart reply, frame 0 is the target peer's routing identity, every frame before the last carries SNDMORE=1, and the final frame carries SNDMORE=0:
    [Frame 0: identity (SNDMORE=1)] -> [Frame 1: msgpack header (SNDMORE=1)] -> [Frame 2: tensor buffer (SNDMORE=0)]
    Once frame 0 enters the ROUTER with SNDMORE=1, libzmq attaches every subsequent frame sent on that socket to the same peer's envelope until a frame with SNDMORE=0 closes the envelope. libzmq exposes neither a getsockopt query for outbound SNDMORE state nor an API to roll back queued frames without closing the socket.
  2. Receiver-side ZMTP atomic delivery rule: A receiving DEALER holds incoming SNDMORE=1 frames inside libzmq's C++ session buffer until the terminating SNDMORE=0 frame arrives. If the server process exits and drops the TCP connection before sending SNDMORE=0, the client's libzmq discards the incomplete multipart message atomically and surfaces a clean zmq.Again (TransferTimeout) to Python rather than exposing partial frames.

2. Four Reliability Problems Solved in PR #228

2.1 Silent Loss of Concurrent Queued Requests on Pre-Send Errors (inproc:// Pipe Drain Bug)

Prior to PR #228, an unhandled pre-send exception on one request silently destroyed concurrent requests from innocent peers that had already entered the unit process. Under the legacy two-thread architecture, proxy_thread forwarded frames between the TCP ROUTER and an inproc:// DEALER socket, while worker_thread read from a connected worker_socket (inproc:// DEALER, RCVHWM=0). To keep a single failed request from killing the sole worker, PR #204 caught Exception in _worker_loop, called worker_socket.close(linger=0), and connected a replacement worker_socket.

Consider two concurrent clients hitting the same SimpleStorageUnit:

  1. Client A sends a GET request (req_A), and Client B simultaneously sends a non-idempotent UPDATE request (req_B, max_attempts=1, never retried).
  2. proxy_thread immediately drains both req_A and req_B from the TCP ROUTER and pushes both into worker_socket's inproc:// receive queue. req_B is now buffered inside worker_socket.
  3. worker_thread pops req_A and hits an unexpected pre-send error before writing anything back to worker_socket (for example, an interrupted call or a non-buffer object raising TypeError).
  4. _worker_loop executes worker_socket.close(linger=0) to reset socket state, destroying req_B sitting unread in the old worker_socket's inproc:// receive queue.
  5. This failure creates an observability blind spot: because the TCP handshake succeeded, AcceptQueueProbe (PR #172) reports sk_drops=0; because req_B died before decoding, requests_arrived never increments; and by the time Client B times out and runs _diagnose_storage_unit (PR #171), the replacement worker_socket is serving normally again—making an internal queue drop look identical to an external network packet loss (tcp=up, unit healthy, arrival missing).

PR #228 eliminates this failure path by serving put_get_socket (ROUTER) directly and validating all reply frames before touching the socket. req_B stays queued in put_get_socket until worker_thread finishes req_A, and _send_multipart_reply materializes every zmq.Frame before calling router_socket.send. Any error before the first SNDMORE frame leaves put_get_socket untainted, so _worker_loop logs the failure without closing put_get_socket and immediately serves req_B on the next iteration.

2.2 Cross-Client Reply Misrouting on Mid-SNDMORE Failures (and Why Naive Recovery Fails)

Reusing a ROUTER socket after a mid-SNDMORE failure routes the next client's reply into the previous client's open envelope. Suppose the worker sends send("Client_A", SNDMORE=1) and then raises (e.g., on an allocation failure) before sending the final SNDMORE=0 frame. If _worker_loop swallows that error and processes Client B's request next, calling send("Client_B", SNDMORE=1) followed by send(Reply_B, SNDMORE=0) appends "Client_B" and Reply_B onto Client A's unfinished envelope: Client A receives shifted, corrupt frames (surfacing as ZMQMessageDecodeError from PR #143), while Client B hangs until timeout.

sequenceDiagram
    participant CA as Client A
    participant R as ROUTER Socket
    participant W as Worker Thread
    participant CB as Client B

    CA->>R: 1. Send req_A
    CB->>R: 2. Send req_B
    R->>W: Pop req_A
    W->>R: send("Client_A", SNDMORE=1) [envelope opened, uncommitted]
    W--xW: Exception on subsequent frame; SNDMORE=0 never sent
    Note over W,R: Broken recovery: swallow error and reuse tainted ROUTER
    R->>W: Pop req_B
    W->>R: send("Client_B", SNDMORE=1) [appended into Client A's envelope]
    W->>R: send(Reply_B, SNDMORE=0) [envelope sealed]
    R-->>CA: Delivers Client B's reply to Client A (misrouted / shifted frames)
    Note over CB: Hangs until receive timeout
Loading

Two seemingly attractive recovery strategies introduce worse failure modes and were deliberately rejected:

  • Rejected Strategy A: Flush an empty router_socket.send(b"") frame on error. If the failure happens after [identity (SNDMORE=1), header (SNDMORE=1)] on a multi-frame GET response, sending b"" seals and delivers [header, b""] to the client. Pairing valid non-empty tensor metadata with an empty b"" buffer frame previously hit if not buffer: return torch.empty(shape) in MsgpackDecoder, silently materializing uninitialized memory as tensor output.
  • Rejected Strategy B: Close put_get_socket(linger=0) and rebind the same TCP port. Closing the shared listener turns one failed reply into a unit-wide outage: (1) close(linger=0) drops all queued requests and outbound replies across every connected peer; (2) put_get_socket binds an OS ephemeral port from get_free_port(), so during the asynchronous Reaper close window another local connect() or bind() on the host can claim that port and fail rebind with EADDRINUSE; and (3) replacing the kernel LISTEN socket resets kernel sk_drops to 0, driving AcceptQueueProbe.sk_drops_delta negative.

PR #228 instead combines upfront frame preparation with fail-fast taint tracking:

  1. Upfront preparation before SNDMORE: response_msg.serialize() and zmq.Frame construction for all frames run before the first router_socket.send call, keeping bad user data_parser outputs or buffer errors strictly ahead of any SNDMORE state change.
  2. Fail-fast abort on _router_tainted: Only if router_socket.send fails after a non-final SNDMORE=1 frame has entered router_socket (which on an SNDHWM=0, non-mandatory ROUTER only enqueues pre-built zmq_msg_t structs in memory and can only fail under process-level C++ heap exhaustion or context corruption) does _send_multipart_reply set self._router_tainted = True, causing _worker_loop to re-raise into _abort_process (exiting visibly with code 70 per PR #201). The unit never misroutes a subsequent reply, and the client's ZMTP layer rolls back the uncommitted frames automatically.

2.3 Busy-Spinning on Unrecoverable poller.poll() Faults

Previously, _worker_loop wrapped poller.poll() in except Exception: continue, causing fatal socket errors such as ENOTSOCK to spin at 100% CPU logging warnings inside an actor that Ray still considered healthy. PR #228 retries only errno.EINTR, exits cleanly on shutdown or ContextTerminated, and propagates unrecoverable ZMQErrors to _abort_process.

2.4 Startup Readiness Race and ARM64 / Container PyTorch Thread Initialization

  1. Startup race removal: Serving the already-bound ROUTER socket directly removes the inproc:// connect ordering assumption previously masked by time.sleep(0.5).
  2. ARM64 / container core-count fallback and worker-local TLS setup: On aarch64 hosts (such as Kunpeng nodes) or containers that do not expose physical core topology, psutil.cpu_count(logical=False) returns None (raising TypeError on main, or clamping TQ_NUM_THREADS=8 down to 1 thread if defaulted naively to 1). set_pytorch_auto_parallel_threads() now falls back via psutil.cpu_count(logical=False) or psutil.cpu_count(logical=True) or os.cpu_count() or 1 and runs once at the start of _worker_routine, configuring ATen / OpenMP's per-thread nthreads-var directly on worker_thread without per-request /proc/cpuinfo reads or main-thread side effects during in-process tests.

3. End-to-End Fault Isolation and Observability Map

Across the ZMQ transport stack, root-cause fixes and residual diagnostics divide cleanly by layer:

  • Client-side frame mixing & stale socket reuse -> Solved by long-lived zmq.Context (PR #145) and exclusive ZMQSocketPool leases that discard timed-out or cancelled DEALER sockets (PR #167).
  • Stray non-TransferQueue TCP traffic / port scanners -> Dropped silently before decoding via STORAGE_CLIENT_IDENTITY_PREFIXES (PR #168, preserved at the top of _process_one_worker_request in PR #228).
  • Unit-internal inproc queue drops, mid-SNDMORE reply misrouting, and poller busy-spins -> Eliminated by PR #228, escalating unrecoverable process/socket faults to _abort_process (PR #201).
  • External network drops, async DEALER initial handshake queuing, kernel accept-queue overflow, and future transport debugging -> Continue to rely on:
    • describe_frames() in ZMQMessage.deserialize (PR #143) to distinguish corrupt payloads from shifted frame boundaries immediately;
    • Unified client-side log_heavy_operation (PR #171, unified across PUT, UPDATE, and GET in PR #228);
    • AcceptQueueProbe, requests_arrived, and post-timeout _diagnose_storage_unit probes (PR #171, PR #172, PR #192).

4. Implementation Notes for Future Changes

  1. Preserve pyzmq's copy_threshold when constructing zmq.Frames: Calling zmq.Frame(memoryview(part), copy=False) unconditionally bypasses router_socket.copy_threshold (65536 bytes), registering tiny ~100-byte response headers in zmq.utils.garbage.gc.refs and waking pyzmq's background GarbageCollectorThread over inproc://pyzmq.gc.01 (acquiring the Python GIL) on every reply. Use zmq.Frame(memoryview(part), copy=None, copy_threshold=router_socket.copy_threshold) so < 64 KB control frames copy inline in C while >= 64 KB tensor buffers remain zero-copy.
  2. Inbound RCVMORE symmetry: If an exception ever interrupts router_socket.recv_multipart(copy=False) after frame 0 while router_socket.getsockopt(zmq.RCVMORE) is non-zero and the worker loop continues, draining remaining RCVMORE frames (or treating mid-receive failure as fatal) prevents inbound frame-boundary shifts on the next request.

Activity

  1. 0oshowero0 commented on Nov 26, 2026

    @0oshowero0
    CollaboratorAuthor

    中文版:SimpleStorageUnit 的 ZMQ 多帧边界、静默丢包根因与故障隔离机制

    TL;DR
    PR #228 移除了 SimpleStorageUnit 内部的 ROUTER <-> proxy_thread <-> inproc DEALER 转发层,改为由单 worker_thread 直接轮询并读写 TCP ROUTER socket。这次重构除了消除每次请求两次额外的 ZMQ 转发与 0.5s 启动等待外,还从根源上解决了两类长期难以复现的稳定性隐患:(1)单请求发送前报错触发 inproc 重连时,连带静默销毁其他并发客户端排队请求;(2)多帧回复中途失败(SNDMORE 未完结)导致的跨客户端串包与帧边界错位。本文档记录完整的协议机制、反面方案陷阱以及各历史可观测性 PR 的职责边界,供后续维护存储后端时参考。

    相关 PR:#143, #145, #167, #168, #171, #172, #192, #201, #204, #214, #228


    1. 前置底层规则:ZMQ ROUTER 的多帧封箱契约

    SimpleStorageUnit 通过单个 TCP ROUTER socket(put_get_socket)接收多个 AsyncSimpleStorageManager(DEALER socket)发来的请求并回包。理解所有故障模式只需记住两条 ZMQ / ZMTP 3.x 底层规则:

    1. 发送端 SNDMORE 封箱规则:ROUTER 发送一条多帧回复时,第 0 帧必须是目标客户端的 identity,除最后一帧外每一帧都带有 SNDMORE=1 标志,最后一帧带 SNDMORE=0:
      [Frame 0: identity (SNDMORE=1)] -> [Frame 1: msgpack header (SNDMORE=1)] -> [Frame 2: tensor buffer (SNDMORE=0)]
      只要第 0 帧带着 SNDMORE=1 进入了 ROUTER,libzmq 就会把后续写入该 socket 的所有帧都归入同一个收件人信封,直到看见某一帧的 SNDMORE=0 才封箱发走。libzmq 没有提供查询“当前是否处于 SNDMORE 未封箱状态”的 API,也没有提供在不关闭 socket 的前提下回滚已入队帧的 API。
    2. 接收端 ZMTP 原子投递规则:客户端 DEALER 在收到最后一帧(SNDMORE=0)之前,会把前面已到达的帧扣留在 libzmq 的 C++ 会话缓冲区内,不会向 Python recv_multipart() 暴露任何数据。如果服务端在发出 SNDMORE=0 之前进程退出并断开 TCP 连接,客户端 libzmq 会自动整包丢弃这半截未封箱的帧,Python 层只会收到干净的超时异常 zmq.Again(TransferTimeout)。

    2. PR #228 解决的四类核心可靠性问题

    2.1 单请求发送前异常连带吞掉其他并发请求(inproc:// 队列静默丢包)

    旧架构中单个请求在发送响应前报错,会连带销毁同一时刻其他客户端已发入进程的所有排队请求。在 PR #228 之前,SimpleStorageUnit 包含两条后台线程:proxy_thread 负责在外部 TCP ROUTER 与内部 inproc:// DEALER 之间搬运帧,worker_thread 连接 worker_socket(inproc:// DEALER,RCVHWM=0)处理业务。PR #204 为了让单次请求异常不杀死唯一的 worker_thread,在 except Exception 分支中执行 worker_socket.close(linger=0) 并新建 worker_socket 重连。

    用一个双客户端并发的例子还原丢包全过程:

    1. Client A 发送 GET 请求 req_A,同一时刻 Client B 发送非幂等的 UPDATE 请求 req_B(max_attempts=1,不允许自动重试)。
    2. proxy_thread 不会等待 worker_thread 空闲,而是立刻把 req_A 和 req_B 全部从 TCP ROUTER 抽出并塞进 worker_socket 的 inproc:// 接收队列。此时 req_B 已经离开 ROUTER,躺在 worker_socket 内部排队。
    3. worker_thread 取出 req_A 处理,假设在调用 send 之前发生异常(例如瞬态 EINTR 或响应中包含非 buffer 对象触发 TypeError)。
    4. _worker_loop 捕获异常并执行 worker_socket.close(linger=0),躺在旧 worker_socket 接收队列里尚未被读取的 req_B 随之被静默销毁。
    5. 这会在可观测性上制造“幽灵丢包”假象:TCP 握手早已完成,因此 AcceptQueueProbe(PR #172)看到的内核 sk_drops 为 0;req_B 死在解码前,因此 requests_arrived 不会增加;等 Client B 超时后发起 _diagnose_storage_unit 探针(PR #171)时,新的 worker_socket 早已恢复响应,诊断日志只能报告 tcp=up 且存储节点服务正常,表现与网络层无故丢包完全一致。

    PR #228 通过去掉 inproc:// 转发层并前置帧校验彻底消除了这一丢包路径。现在 req_B 直接排在 put_get_socket(ROUTER)自身的接收队列中,_send_multipart_reply 在触碰 router_socket.send 之前先在内存中构造完所有 zmq.Frame。任何发送前异常都不会向 ROUTER 写入 SNDMORE 帧,因此 _worker_loop 无需关闭 put_get_socket,下一轮循环直接取出 req_B 正常处理。

    2.2 SNDMORE 发送中途故障引发的跨客户端串包与修复陷阱

    多帧发送一旦在第 0 帧 identity (SNDMORE=1) 入队后中断,继续复用同一个 ROUTER 会把下一个客户端的整包响应错寄给上一个客户端。假设服务端回复 Client A 时成功执行了 send("Client_A", SNDMORE=1),但在发送后续帧时因底层内存分配失败抛错退出,没有发出 SNDMORE=0。如果 worker_thread 捕获异常后继续处理 Client B 的请求并调用 send("Client_B", SNDMORE=1) 和 send(Reply_B, SNDMORE=0),ROUTER 会把 "Client_B" 和 Reply_B 当作 Client A 未封口信封的后续帧一并封箱发给 Client A。结果是 Client A 收到帧边界错位的脏数据(触发 PR #143 记录的 ZMQMessageDecodeError),而 Client B 永久挂死直到超时。

    sequenceDiagram
        participant CA as Client A
        participant R as ROUTER Socket
        participant W as Worker Thread
        participant CB as Client B
    
        CA->>R: 1. 发送 req_A
        CB->>R: 2. 发送 req_B
        R->>W: 取出 req_A
        W->>R: send("Client_A", SNDMORE=1) [信封已拆开,未封口]
        W--xW: 发送后续帧抛异常,未发 SNDMORE=0
        Note over W,R: 错误做法:吞掉异常继续复用脏 ROUTER
        R->>W: 取出 req_B
        W->>R: send("Client_B", SNDMORE=1) [被拼入 Client A 的信封]
        W->>R: send(Reply_B, SNDMORE=0) [封口发送]
        R-->>CA: 把 Client B 的回复错发给 Client A(串包 / 帧错位)
        Note over CB: 永远收不到回包,超时失败
    
    Loading

    在设计去掉 inproc:// 后的恢复方案时,有两个看似自然但实际会引入严重副作用的“陷阱方案”应当避免:

    • 陷阱方案 A:在 except 中补发空帧 router_socket.send(b"") 强行封口。如果异常发生在 [identity (SNDMORE=1), header (SNDMORE=1)] 之后、Tensor 数据帧之前,补发 b"" 会把残缺消息 [header, b""] 正式封箱投递给客户端。客户端解码器看到非空 Tensor 元数据配上一帧空 buffer b"",此前甚至会命中 if not buffer: return torch.empty(shape) 分支,静默构造出一块未初始化的随机内存张量交给训练逻辑。
    • 陷阱方案 B:在 except 中 put_get_socket.close(linger=0) 并重新 bind 原端口。这种做法会把单请求故障放大为全节点故障:(1)close(linger=0) 会瞬间丢弃该 ROUTER 上所有其他并发客户端已排队的请求及尚在发送缓冲区的响应;(2)put_get_socket 绑定的是 get_free_port() 从操作系统临时端口段分配的端口,在异步释放 fd 到重新 bind 成功的空窗期内,同节点其他进程的出向 connect() 极易抢占该临时端口,导致重绑报 EADDRINUSE 失败;(3)新建内核 LISTEN socket 会使内核 sk_drops 计数归零,导致 AcceptQueueProbe 算出负数的 sk_drops_delta。

    PR #228 采用了“前置校验隔离常规错误 + _router_tainted 快速停机兜底极端错误”的两层设计:

    1. 前置隔离:response_msg.serialize() 和全部响应帧的 zmq.Frame 构造都在调用第一次 router_socket.send 之前完成。用户的 data_parser 返回非法对象或 buffer 转换失败全部在写入 SNDMORE 前拦截,put_get_socket 不受污染。
    2. 脏状态快速退出:只有在非末尾帧带着 SNDMORE=1 已经进入 router_socket、且后续帧 send 抛错时(由于 ROUTER 配置了 SNDHWM=0 且 ROUTER_MANDATORY=0,此处仅做内存无锁管道入队,只有进程级 C++ 堆耗尽或 Context 损坏才会失败),才将 self._router_tainted 置为 True 并上抛触发 _abort_process(以退出码 70 终止进程,见 PR #201)。服务端拒绝带病发包杜绝了串包,客户端则依靠 ZMTP 原子多帧语义自动丢弃未封箱半包。

    2.3 不可恢复 poller.poll() 故障下的死循环假活

    旧版 _worker_loop 用宽泛的 except Exception: continue 包裹 poller.poll(),一旦底层 socket 出现不可恢复故障(如 ENOTSOCK),工作线程会占满单核 CPU 无限刷告警日志,而 Ray Actor 表面存活却永不响应任何请求。PR #228 将轮询异常处理收紧为仅在 errno.EINTR 时重试、在 _shutdown_event 置位或 ContextTerminated 时优雅退出,其余 ZMQError 直接上抛触发 _abort_process 让故障显式暴露。

    2.4 启动竞态消除与鲲鹏 ARM64 / 容器环境下的 PyTorch 线程初始化

    1. 消除 0.5s 启动竞态:去掉 inproc:// 代理后,不再需要靠 time.sleep(0.5) 猜测 worker_thread 是否已连上 inproc:// 后端 socket。
    2. 修复 ARM64 / 容器环境的核数回退与线程局部状态(TLS):在未暴露物理核拓扑的鲲鹏 aarch64 节点或受限容器中,psutil.cpu_count(logical=False) 会返回 None(旧代码会触发 TypeError;若简单回退为 1,则会把默认的 TQ_NUM_THREADS=8 强行降级为单线程)。新实现提取了 set_pytorch_auto_parallel_threads(),按 psutil.cpu_count(logical=False) or psutil.cpu_count(logical=True) or os.cpu_count() or 1 顺序回退,并放在 _worker_routine 入口执行一次——既直接在执行算子的工作线程上初始化 ATen / OpenMP 的线程局部 nthreads-var,又消除了逐请求读取 /proc/cpuinfo 和改写进程全局线程数的开销。

    3. 全链路故障与可观测性全景对照

    结合此前一系列稳定性 PR,当前 SimpleStorage 在客户端、网络层与服务端各层的故障防护与可观测性分工如下:

    • 客户端侧混帧与死连接复用 -> 由 PR #145(长生命周期 zmq.Context)与 PR #167(ZMQSocketPool 独占租约,超时或取消立即销毁中毒 DEALER socket)根除。
    • 非 TransferQueue 外部探针/扫描流量 -> 由 PR #168 引入并在 PR #228 保留在 _process_one_worker_request 入口的 STORAGE_CLIENT_IDENTITY_PREFIXES 白名单直接静默丢弃。
    • 服务端内部 inproc 重连吞并发请求、多帧发送半包串包、Poller 坏死空转 -> 由 PR #228 根除;不可恢复故障统一收敛至 PR #201 的 _abort_process(退出码 70)。
    • 跨机网络丢包、异步 DEALER 首次握手期排队、内核 BACKLOG 溢出与未来新传输协议排障 -> 继续依赖并保留以下可观测性机制:
      • ZMQMessage.deserialize 中的 describe_frames()(PR #143):一旦未来修改编解码或传输层再次引发帧错位,第一时间输出每帧字节分布;
      • 客户端统一慢请求/大包日志 log_heavy_operation(PR #171,在 PR #228 中统一覆盖客户端侧 PUT / UPDATE / GET);
      • 服务端 AcceptQueueProbe、requests_arrived 与客户端超时探针 _diagnose_storage_unit(PR #171、PR #172、PR #192):用于区分外部建连丢包(request_lost_in_flight)与服务端慢请求阻塞(unit_not_serving)。

    4. 后续维护注意事项

    后续修改 _send_multipart_reply 或 _worker_loop 时需注意两个底层细节:

    1. 保留 pyzmq 对小帧的内联拷贝阈值(copy_threshold):直接调用 zmq.Frame(memoryview(part), copy=False) 会绕过 router_socket.copy_threshold(默认 65536 字节),导致百字节级的响应 header 也被注册进 zmq.utils.garbage.gc.refs,拉起并频繁通过 inproc://pyzmq.gc.01 唤醒 pyzmq 内置的后台 GarbageCollectorThread 争抢 GIL。构造预备帧时应使用 zmq.Frame(memoryview(part), copy=None, copy_threshold=router_socket.copy_threshold),使 < 64 KB 的控制帧走 C 层内联拷贝、>= 64 KB 的大张量帧保持零拷贝。
    2. 接收侧 RCVMORE 对称排空:如果在 router_socket.recv_multipart(copy=False) 读出第 0 帧后遭遇极端异常中断且循环继续,残留在 put_get_socket 头部的后续帧(getsockopt(zmq.RCVMORE) == 1)会导致下一轮读取发生接收侧帧边界偏移;在异常恢复分支排空 RCVMORE(或将其视为不可恢复错误退出)可保持收发两侧边界对称。
  2. added
    documentation
    on Nov 26, 2026
  3. self-assigned this
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

documentation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions