You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by sw...@apache.org on 2023/12/26 01:43:31 UTC

(logging-log4cxx) branch master updated: Prevent potential deadlock on shutdown when using AsyncAppender (#319)

This is an automated email from the ASF dual-hosted git repository.

swebb2066 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git


The following commit(s) were added to refs/heads/master by this push:
     new d9daa717 Prevent potential deadlock on shutdown when using AsyncAppender (#319)
d9daa717 is described below

commit d9daa7178f4bf614dd11b99e7618233e49535863
Author: Stephen Webb <st...@ieee.org>
AuthorDate: Tue Dec 26 12:43:26 2023 +1100

    Prevent potential deadlock on shutdown when using AsyncAppender (#319)
---
 src/main/cpp/asyncappender.cpp | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/main/cpp/asyncappender.cpp b/src/main/cpp/asyncappender.cpp
index 07083474..c8389840 100644
--- a/src/main/cpp/asyncappender.cpp
+++ b/src/main/cpp/asyncappender.cpp
@@ -502,13 +502,19 @@ void AsyncAppender::dispatch()
 			}
 			catch (std::exception& ex)
 			{
-				priv->errorHandler->error(LOG4CXX_STR("async dispatcher"), ex, 0, *iter);
-				isActive = false;
+				if (isActive)
+				{
+					priv->errorHandler->error(LOG4CXX_STR("async dispatcher"), ex, 0, *iter);
+					isActive = false;
+				}
 			}
 			catch (...)
 			{
-				priv->errorHandler->error(LOG4CXX_STR("async dispatcher"));
-				isActive = false;
+				if (isActive)
+				{
+					priv->errorHandler->error(LOG4CXX_STR("async dispatcher"));
+					isActive = false;
+				}
 			}
 		}
 	}