[ 
https://issues.apache.org/jira/browse/LOGCXX-537?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17457772#comment-17457772
 ] 

Robert Middleton commented on LOGCXX-537:
-----------------------------------------

Future reference for me: ISOCPP guidelines recommend using a [recursive 
mutex|http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cp22-never-call-unknown-code-while-holding-a-lock-eg-a-callback]
 if you're calling unknown code(e.g. callback).

Since that is basically what is happening here, maybe the recursive mutex is 
not a bad idea.  I need to think about this a little bit - it may make sense to 
make things have recursive mutexes as they did before, but that may wait until 
the next major version(since there are probably a number of locations where 
this would be useful).

> double mutex lock
> -----------------
>
>                 Key: LOGCXX-537
>                 URL: https://issues.apache.org/jira/browse/LOGCXX-537
>             Project: Log4cxx
>          Issue Type: Bug
>          Components: Appender
>    Affects Versions: 0.12.1
>         Environment: Ubuntu 18.04
>            Reporter: Truman Lackey
>            Priority: Major
>             Fix For: 0.13.0
>
>
> There is a possibility of the SocketAppender calling 
> std::unique_lock<log4cxx::shared_mutex> lock(mutex) twice causing a deadlock 
> exception. In socketappenderskeleton.cpp connect call if the exception is 
> caught on line 118 then fireConnector() will be called.  On line 160 the 
> mutex is attempted to be locked again but it has already been locked in the 
> appendersleketo.cpp doAppend call. This causes log4cxx to throw a  
> std::err::resource_deadlock_would_occur



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to