From: Alexander A. Klimov Date: Mon, 3 Dec 2018 18:05:41 +0000 (+0100) Subject: HttpServerConnection#DataAvailableHandler(): be aware of being called multiple times... X-Git-Tag: v2.11.0-rc1~274^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7e630c7732c6ce52987509ec36200e5baee4eefe;p=icinga2 HttpServerConnection#DataAvailableHandler(): be aware of being called multiple times concurrently refs #6816 --- diff --git a/lib/remote/httpserverconnection.cpp b/lib/remote/httpserverconnection.cpp index 356a0ffba..88234e837 100644 --- a/lib/remote/httpserverconnection.cpp +++ b/lib/remote/httpserverconnection.cpp @@ -351,7 +351,11 @@ void HttpServerConnection::DataAvailableHandler() bool close = false; if (!m_Stream->IsEof()) { - boost::recursive_mutex::scoped_lock lock(m_DataHandlerMutex); + boost::recursive_mutex::scoped_try_lock lock(m_DataHandlerMutex); + if (!lock.owns_lock()) { + Log(LogInformation, "HttpServerConnection", "Unable to process available data, they're already being processed in another thread"); + return; + } try { while (ProcessMessage())