Skip to content

Upstream: Guard against writing to disconnected Signaler socket #3

Description

@follesoe

Patch

Commit `f4c51567`Only write if the socket is connected (Jonas Follesø, 2025-11-11).

Files: `src/NetMQ/Core/Utils/Signaler.cs` (+1 line)

What the patch does

One-line guard in `Signaler` to only attempt a write if the underlying socket is still connected. Defends against the scenario where the Signaler's internal TCP loopback socket has been closed (e.g. iOS app resume after the kernel reclaimed sockets in the background) and a subsequent write would error or crash.

Originally added to address zeromq/netmq#1032 (issues with resuming iOS apps where the underlying socket has been closed).

Status vs upstream today

Upstream has not addressed iOS-resume socket-closure semantics in Signaler; this patch is BlueyeApp-specific hardening.

Upstreaming work

  • Reproduce the iOS-resume scenario in a controlled test (background the app, force socket reclaim, foreground, observe).
  • Build a runtime-agnostic test: force-close the loopback socket on a Signaler then call `Send`, verify the new guard prevents the throw / crash.
  • Discuss with upstream whether the guard should be in Signaler or upstream of it (i.e. detect the disconnect higher in the call chain).
  • Consider whether iOS app-resume should recreate the Signaler rather than guard each write.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions