zeromq / libzmq

ZeroMQ core engine in C++, implements ZMTP/3.1
https://www.zeromq.org
Mozilla Public License 2.0
9.67k stars 2.35k forks source link

How to achieve self-repair, instead of crashing, when the loopback connection within zmq::signaler_t is interrupted in a Windows environment? #4646

Closed hjyheb closed 9 months ago

hjyheb commented 9 months ago

Problem Description

A firewall or certain network control programs have interrupted the local loopback connection, causing the TCP connection within zmq::signaler_t to be disconnected. This triggers an exception, leading to a crash in the program that is loading libzmq.

Environment

libzmq version: 4.3.5 Operating System: Windows 11

Minimal Test Code/Steps to Reproduce the Issue

  1. Start the HttpDebuggerPro service.
  2. Check the status of the HttpDebuggerSdk driver to see if it is running: sc query HttpDebuggerSdk.
  3. Run test_xpub_welcome_msg.exe and let it sleep before test_context_socket_close.
  4. Stop the HttpDebuggerSdk driver.
  5. Stop the HttpDebuggerPro service.
  6. test_xpub_welcome_msg.exe crashes.

Actual Results? (If applicable, include assertion messages and call stack)

Assertion failed: Assertion failed: nbytes == sizeof (dummy) (..\src\signaler.cpp:375) Assertion failed: Assertion failed: nbytes == sizeof (dummy) (..\src\signaler.cpp:375)

Expected Results

Inability to prevent a third-party program from interrupting the loopback connection. libzmq should have self-healing capabilities, and the TCP connection within signaler_t should support reconnection or be returned to the higher-level caller instead of causing a crash in the calling layer.

bluca commented 9 months ago

The internal control socket on the loopback needs to work, otherwise nothing will work. It's internal-only so either allow it or use a windows build with af_unix.