From 54b3a7eeae78b30ed8f4d6e6ab23f0893c6f51e0 Mon Sep 17 00:00:00 2001 From: Jakub Svoboda <132791205+jacobfreedom@users.noreply.github.com> Date: Mon, 31 Aug 2026 14:20:54 +0200 Subject: [PATCH] Prevent Athena UDP logging from blocking Arras Signed-off-by: Jakub Svoboda <132791205+jacobfreedom@users.noreply.github.com> --- .../lib/arras4_athena/UdpSyslog_boost.cc | 25 ++++++------------- .../lib/arras4_athena/UdpSyslog_boost.h | 6 +++++ 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/arras4_log/lib/arras4_athena/UdpSyslog_boost.cc b/arras4_log/lib/arras4_athena/UdpSyslog_boost.cc index 23f63d0..ebcbca8 100755 --- a/arras4_log/lib/arras4_athena/UdpSyslog_boost.cc +++ b/arras4_log/lib/arras4_athena/UdpSyslog_boost.cc @@ -6,8 +6,6 @@ namespace arras4 { namespace log { -const int MAX_SENDTO_RETRIES = 5; - void UdpSyslog::sendMessage(int priority, const tm* timeStamp, const std::string& ident, @@ -45,21 +43,14 @@ void UdpSyslog::sendMessage(int priority, std::string packet = ss.str(); - // send_to can on rare occassons throw system_error because the underlying - // system call sendto() can randomly return EPERM. Just retry and in the - // extremely unlikely case of not working on retries then just drop it - for (int i = 0; i < MAX_SENDTO_RETRIES; i++) { - try { - mSocket.send_to(boost::asio::buffer(packet.data(), packet.size()), mTarget); - - // if it succeeds then break out of the loop - break; - } catch (const boost::system::system_error& e) { - if (e.code() != boost::asio::error::basic_errors::no_permission) { - throw; - } - } - } + // The socket is non-blocking because this path is called inline from Arras + // message delivery. Drop telemetry when the UDP target is unavailable or + // its send buffer is full; logging must not delay or abort rendering. + boost::system::error_code error; + mSocket.send_to(boost::asio::buffer(packet.data(), packet.size()), + mTarget, + 0, + error); } } diff --git a/arras4_log/lib/arras4_athena/UdpSyslog_boost.h b/arras4_log/lib/arras4_athena/UdpSyslog_boost.h index 9206012..7188eb4 100755 --- a/arras4_log/lib/arras4_athena/UdpSyslog_boost.h +++ b/arras4_log/lib/arras4_athena/UdpSyslog_boost.h @@ -36,6 +36,12 @@ class UdpSyslog boost::asio::ip::udp::endpoint anyAddress; mSocket.bind(anyAddress); + // Athena logging is best-effort telemetry and must never stall the + // caller. This logger is used directly from latency-sensitive Arras + // message paths, so a blocking UDP send can otherwise stop scene + // updates when no local syslog daemon is draining port 514. + mSocket.non_blocking(true); + // resolve hostname to target endpoint boost::asio::ip::udp::resolver hostNameResolver(mService); auto results = hostNameResolver.resolve(boost::asio::ip::udp::v4(), addr, std::to_string(port));