logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Curt Arnold <carn...@apache.org>
Subject Re: Segmentation fault log4cxx 0.10.0 on app exit ( RH Linux)
Date Fri, 30 May 2008 21:40:25 GMT

On May 30, 2008, at 3:16 PM, GregN wrote:
> Unfortunately your suggestion didn't fix the issue.
> Under debugger the problem happen in apr_atomic.c::apr_atomic_dec32()
> line:310.
> It is inside #if APR_HAS_THREADS.
> I tried to set APR_HAS_THREADS to 0 in include/apr.h but got system  
> lookup
> error.

APR_HAS_THREADS ==1 is right and expected, the question is why:

#if (defined(__i386__) || defined(__x86_64__)) && defined(__GNUC__)  
&& !defined(USE_GENERAL_ATOMICS)

is not true.

Forget what I was saying about LoggerPtr.  Looking at the stack trace  
again that isn't the issue.  The call to apr_atomic_dec32 that is  
crashing isn't in the base class for LoggerPtr, it is in the base  
class (ObjectImpl) for some log4cxx object that is defined as a  
static.  Just not clear which one.

A workaround until we can figure out the issue would be to change  
objectimpl.cpp to avoid apr_atomic_inc32 and apr_atomic_dec32:

Index: src/main/cpp/objectimpl.cpp
===================================================================
--- src/main/cpp/objectimpl.cpp	(revision 654826)
+++ src/main/cpp/objectimpl.cpp	(working copy)
@@ -36,12 +36,12 @@

  void ObjectImpl::addRef() const
  {
-  apr_atomic_inc32( & ref );
+  ref++;
  }

  void ObjectImpl::releaseRef() const
  {
-  if ( apr_atomic_dec32( & ref ) == 0 )
+  if ( --ref == 0 )
    {
      delete this;
    }




Mime
View raw message