ZeroMQ pusher: say so when a stalled writer switches the socket to dropping

A send that blocked for over a second drops that image and turns the socket non-blocking for
the rest of the run, so every later image that finds the queue full is dropped too - without a
word in the log. Log the moment it happens, once per run, with the image number.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
2026-10-13 12:51:34 +02:00
co-authored by Claude Fable 5.1
parent 6202d36268
commit a5b4529f9c
+6
View File
@@ -3,6 +3,8 @@
#include "ZMQStream2PusherSocket.h"
#include <spdlog/spdlog.h>
void zmq_socket_free(void *data, void *hint) {
auto z = (ZeroCopyReturnValue *) hint;
z->release();
@@ -56,6 +58,10 @@ void ZMQStream2PusherSocket::WriterThread() {
// When hitting timeout on SendZeroCopy consider it a transmission error and switch to non-blocking communication
bool blocking_send = !transmission_error;
if (!s.SendZeroCopy(e.z->GetImage(), e.z->GetImageSize(), zmq_socket_free, e.z, blocking_send)) {
if (!transmission_error)
spdlog::warn("ZeroMQ image socket {}: send blocked for over a second - image {} dropped, and "
"images that find the queue full are dropped for the rest of the run",
s.GetEndpointName(), e.z->GetImageNumber());
transmission_error = true;
// The slot is already released: on a failed send SendZeroCopy closes the message, and
// closing a zmq_msg_init_data message runs its free function (zmq_socket_free).