logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Unnikrishnan Udinoor" <uudin...@Brocade.COM>
Subject RE: Core dump in Solaris - log4cxx 0.10.0 Sample Program.
Date Tue, 06 May 2008 17:49:37 GMT
Hi,

We still don't have a solution yet for this problem. 

Can someone give some idea/ tips for fixing this issue.

 

Regards

Unni

 

________________________________

From: Unnikrishnan Udinoor 
Sent: Wednesday, April 30, 2008 7:02 PM
To: Log4CXX User
Cc: carnold@apache.org
Subject: RE: Core dump in Solaris - log4cxx 0.10.0 Sample Program.

 

Hi Curt,

Tried with the changes you suggested. But now the program core dump as
soon as we execute. The following are the changes made to the file. I
have highlighted the area where the changes are done. 

The combinations tried are 

*       only using atomic_dec

*       only using ref

*       using automic _dec and automic_inc

Each case we get core dump.

 

Attached the output of the core dump details for all three combinations.

 

Regards

Unnikrishnan

 

Machine details :

 

Log4cxx is build using the following machine
uudinoor@aspen{201}: uname -a
SunOS aspen 5.10 Generic_125100-08 sun4u sparc SUNW,Sun-Fire-280R
 
uudinoor@aspen{203}: /usr/sfw/bin/g++ -v
Reading specs from /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/specs
Configured with:
/gates/sfw10/builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure
--prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as
--with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++
--enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
 
gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
uudinoor@aspen{204}: /usr/sfw/bin/gcc -v
Reading specs from /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/specs
Configured with:
/gates/sfw10/builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure
--prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as
--with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++
--enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
 
uudinoor@aspen{206}: /bin/isainfo -kv
64-bit sparcv9 kernel modules
 
 
Program is build and executed using following machine 
 
sol10-116200# uname -a
SunOS sol10-116200 5.10 Generic_127111-01 sun4u sparc
 SUNW,Sun-Fire-V245
 
sol10-116200#
sol10-116200# /usr/sfw/bin/g++ -v
Reading specs from /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/specs
Configured with:
 /gates/sfw10/builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure
--prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as
 --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++
 --enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
 
sol10-116200#
sol10-116200# /usr/sfw/bin/gcc -v
Reading specs from /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/specs
Configured with:
/gates/sfw10/builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure
--prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as
--with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++
--enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
 
sol10-116200# /bin/isainfo -kv
64-bit sparcv9 kernel modules

 

 

 

 

FILE - objectimpl.cpp

 

/*

 * Licensed to the Apache Software Foundation (ASF) under one or more

 * contributor license agreements.  See the NOTICE file distributed with

 * this work for additional information regarding copyright ownership.

 * The ASF licenses this file to You under the Apache License, Version
2.0

 * (the "License"); you may not use this file except in compliance with

 * the License.  You may obtain a copy of the License at

 *

 *      http://www.apache.org/licenses/LICENSE-2.0

 *

 * Unless required by applicable law or agreed to in writing, software

 * distributed under the License is distributed on an "AS IS" BASIS,

 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.

 * See the License for the specific language governing permissions and

 * limitations under the License.

 */

 

#include <log4cxx/logstring.h>

#include <log4cxx/helpers/objectimpl.h>

//#include <apr_atomic.h>

#include <atomic.h>

#if !defined(LOG4CXX)

#define LOG4CXX 1

#endif

#include <log4cxx/helpers/aprinitializer.h>

 

using namespace log4cxx::helpers;

 

ObjectImpl::ObjectImpl() : ref( 0 )

{

  log4cxx::helpers::APRInitializer::initialize();

}

 

ObjectImpl::~ObjectImpl()

{

}

 

void ObjectImpl::addRef() const

{

  //apr_atomic_inc32( & ref );

  atomic_inc_32( & ref );

}

 

void ObjectImpl::releaseRef() const

{

  //if ( apr_atomic_dec32( & ref ) == 0 )

  atomic_dec_32( & ref );

  //--ref;

  //{

    delete this;

  //}

}

 

 

Incase you are unable to access the attachment, atomic_inc_dec.txt

 

Script started on Wed Apr 30 14:34:47 2008

sol10-116200# dbx a.out core

For information   about new features see `help changes'

To remove this message, put `dbxenv suppress_startup_message 7.6' in
your .dbxrc

Reading     a.out

core file header read successfully

Reading     ld.so.1

Reading     libnsl.so.1

Reading     librt.so.1

Reading     libsendfile.so.1

Reading     libsocket.so.1

Reading     libpthread.so.1

Reading     liblog4cxx.so.10

Reading     libaprutil-1.so.0

Reading     libapr-1.so.0

Reading     libexpat.so.0

Reading     libstdc++.so.6.0.3

Reading     libm.so.2

Reading     libgcc_s.so.1

Reading     libc.so.1

Reading     libaio.so.1

Reading     libmd.so.1

Reading     libuuid.so.1

Reading     libc_psr.so.1

t@1 (l@1) program terminated by     signal SEGV (no   mapping     at the
fault address)

Current     function is log4cxx::Hierarchy::~Hierarchy

   70     delete loggers;

(dbx) where

current     thread:     t@1

dbx: internal warning: Visiting     state accessed while locked

dbx: internal warning: Visiting     state accessed while locked

=>[1] log4cxx::Hierarchy::~Hierarchy(this = 0x3), line 70 in
"hierarchy.cpp"

  [2] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70),   line
50      in "objectimpl.cpp"

  [3]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line    100 in "objectptr.h"

  [4] 0xffffffffff109a88(0x24bfc, 0x0, 0x2000, 0x0, 0xffffffffff2163cc,
0xc), at 0xffffffffff109a88

  [5] 0xffffffffff0eb13c(0x2fc28, 0xffffffffffffffff,
0xffffffffffffb6e2, 0x24bd0, 0x3,     0xffffffffff187398), at
0xffffffffff0eb13c

  [6] 0xffffffffff109a88(0x2fc70, 0x0, 0x97a34, 0xffffffffff219688,
0x2fc28, 0x48), at 0xffffffffff109a88

  [7] 0xffffffffff190f64(0x24bf0, 0xffffffffffffffff,
0xffffffffffffb6e2, 0xffffffffffffb6e2, 0xfffffffffecee32c,
0xffffffffff190ee4), at 0xffffffffff190f64

  [8] 0xffffffffff109a88(0x24bfc, 0x0, 0x2000, 0x0, 0xffffffffff2163cc,
0xc), at 0xffffffffff109a88

  [9] 0xffffffffff0eb13c(0x2fc28, 0xffffffff, 0xffffb6e3, 0x24bd0, 0x3,
0xff187398), at   0xffffffffff0eb13c

  [10] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70), line 50
in "objectimpl.cpp"

  [11]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line 100 in "objectptr.h"

  [12] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x24bfc), line 50
in "objectimpl.cpp"

  [13] log4cxx::Hierarchy::~Hierarchy(this = 0x2fc28), line 100   in
"objectptr.h"

  [14] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70), line 50
in "objectimpl.cpp"

  [15]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line 100 in "objectptr.h"

  [16] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x24bfc), line 50
in "objectimpl.cpp"

  [17] log4cxx::Hierarchy::~Hierarchy(this = 0x2fc28), line 100   in
"objectptr.h"

  [18] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70), line 50
in "objectimpl.cpp"

  [19]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line 100 in "objectptr.h"

  [20] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x24bfc), line 50
in "objectimpl.cpp"

  [21] log4cxx::Hierarchy::~Hierarchy(this = 0x2fc28), line 100   in
"objectptr.h"

  [22] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70), line 50
in "objectimpl.cpp"

  [23]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line 100 in "objectptr.h"

  [24] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x24bfc), line 50
in "objectimpl.cpp"

  [25] log4cxx::Hierarchy::~Hierarchy(this = 0x2fc28), line 100   in
"objectptr.h"

  [26] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70), line 50
in "objectimpl.cpp"

  [27]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line 100 in "objectptr.h"

  [28] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x24bfc), line 50
in "objectimpl.cpp"

  [29] log4cxx::Hierarchy::~Hierarchy(this = 0x2fc28), line 100   in
"objectptr.h"

  [30] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70), line 50
in "objectimpl.cpp"

  [31]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line 100 in "objectptr.h"

  [32] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x24bfc), line 50
in "objectimpl.cpp"

  [33] log4cxx::Hierarchy::~Hierarchy(this = 0x2fc28), line 100   in
"objectptr.h"

  [34] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70), line 50
in "objectimpl.cpp"

  [35]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line 100 in "objectptr.h"

  [36] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x24bfc), line 50
in "objectimpl.cpp"

  [37] log4cxx::Hierarchy::~Hierarchy(this = 0x2fc28), line 100   in
"objectptr.h"

  [38] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70), line 50
in "objectimpl.cpp"

  [39]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line 100 in "objectptr.h"

  [40] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x24bfc), line 50
in "objectimpl.cpp"

  [41] log4cxx::Hierarchy::~Hierarchy(this = 0x2fc28), line 100   in
"objectptr.h"

  [42] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70), line 50
in "objectimpl.cpp"

  [43]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line 100 in "objectptr.h"

  [44] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x24bfc), line 50
in "objectimpl.cpp"

  [45] log4cxx::Hierarchy::~Hierarchy(this = 0x2fc28), line 100   in
"objectptr.h"

  [46] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70), line 50
in "objectimpl.cpp"

  [47]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line 100 in "objectptr.h"

  [48] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x24bfc), line 50
in "objectimpl.cpp"

  [49] log4cxx::Hierarchy::~Hierarchy(this = 0x2fc28), line 100   in
"objectptr.h"

  [50] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70), line 50
in "objectimpl.cpp"

  [51]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line 100 in "objectptr.h"

  [52] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x24bfc), line 50
in "objectimpl.cpp"

  [53] log4cxx::Hierarchy::~Hierarchy(this = 0x2fc28), line 100   in
"objectptr.h"

  [54] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70), line 50
in "objectimpl.cpp"

  [55]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line 100 in "objectptr.h"

  [56] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x24bfc), line 50
in "objectimpl.cpp"

  [57] log4cxx::Hierarchy::~Hierarchy(this = 0x2fc28), line 100   in
"objectptr.h"

  [58] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70), line 50
in "objectimpl.cpp"

  [59]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line 100 in "objectptr.h"

  [60] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x24bfc), line 50
in "objectimpl.cpp"

  [61] log4cxx::Hierarchy::~Hierarchy(this = 0x2fc28), line 100   in
"objectptr.h"

  [62] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70), line 50
in "objectimpl.cpp"

  [63]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line 100 in "objectptr.h"

  [64] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x24bfc), line 50
in "objectimpl.cpp"

  [65] log4cxx::Hierarchy::~Hierarchy(this = 0x2fc28), line 100   in
"objectptr.h"

  [66] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70), line 50
in "objectimpl.cpp"

  [67]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line 100 in "objectptr.h"

  [68] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x24bfc), line 50
in "objectimpl.cpp"

  [69] log4cxx::Hierarchy::~Hierarchy(this = 0x2fc28), line 100   in
"objectptr.h"

  [70] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70), line 50
in "objectimpl.cpp"

  [71]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line 100 in "objectptr.h"

  [72] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x24bfc), line 50
in "objectimpl.cpp"

  [73] log4cxx::Hierarchy::~Hierarchy(this = 0x2fc28), line 100   in
"objectptr.h"

  [74] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70), line 50
in "objectimpl.cpp"

  [75]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line 100 in "objectptr.h"

  [76] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x24bfc), line 50
in "objectimpl.cpp"

  [77] log4cxx::Hierarchy::~Hierarchy(this = 0x2fc28), line 100   in
"objectptr.h"

  [78] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70), line 50
in "objectimpl.cpp"

  [79]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line 100 in "objectptr.h"

  [80] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x24bfc), line 50
in "objectimpl.cpp"

  [81] log4cxx::Hierarchy::~Hierarchy(this = 0x2fc28), line 100   in
"objectptr.h"

  [82] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70), line 50
in "objectimpl.cpp"

  [83]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line 100 in "objectptr.h"

  [84] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x24bfc), line 50
in "objectimpl.cpp"

  [85] log4cxx::Hierarchy::~Hierarchy(this = 0x2fc28), line 100   in
"objectptr.h"

  [86] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70), line 50
in "objectimpl.cpp"

  [87]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line 100 in "objectptr.h"

  [88] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x24bfc), line 50
in "objectimpl.cpp"

  [89] log4cxx::Hierarchy::~Hierarchy(this = 0x2fc28), line 100   in
"objectptr.h"

  [90] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70), line 50
in "objectimpl.cpp"

  [91]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line 100 in "objectptr.h"

  [92] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x24bfc), line 50
in "objectimpl.cpp"

  [93] log4cxx::Hierarchy::~Hierarchy(this = 0x2fc28), line 100   in
"objectptr.h"

  [94] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70), line 50
in "objectimpl.cpp"

  [95]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line 100 in "objectptr.h"

  [96] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x24bfc), line 50
in "objectimpl.cpp"

  [97] log4cxx::Hierarchy::~Hierarchy(this = 0x2fc28), line 100   in
"objectptr.h"

  [98] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x2fc70), line 50
in "objectimpl.cpp"

  [99]
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector(this
= 0x24bf0), line 100 in "objectptr.h"

  [100]     log4cxx::helpers::ObjectImpl::releaseRef(this = 0x24bfc),
line 50 in "objectimpl.cpp"

(dbx) quit

dbx: internal warning: td_ta_clear_event() failed -- debugger service
failed

dbx: internal warning: td_ta_sync_tracking_enable(0) failed -- debugger
service     failed

sol10-116200# exit

 

script done on Wed Apr 30 14:34:57 2008

 

-----Original Message-----
From: Curt Arnold [mailto:carnold@apache.org] 
Sent: Tuesday, April 29, 2008 1:25 PM
To: Log4CXX User
Subject: Re: Core dump in Solaris - log4cxx 0.10.0 Sample Program.

 

 

On Apr 29, 2008, at 2:10 PM, Unnikrishnan Udinoor wrote:

 

> Hi,

> 

> Need your valuable inputs/findings on this issue.

> Let me know if I am missing something here in the procedure.

> This is stopping us from upgrading of the log4cxx libraries to the  

> latest version in our application.

> 

> Problem Highlight:

> 1.    The sample program for log4cxx 0.10.0 core dump if I compile  

> for Solaris sparc and run.

> 2.    Work around is defining the variable locally - i.e. by moving  

> the variable (logger) declaration inside the main().

> 3.    The same program runs fine with Red hat 5.

> 4.    The same program runs fine if I use log4cxx-r603007 version in  

> both Solaris and Red Hat.

> 

 

 

ObjectImpl::releaseRef uses apr_atomic_dec32 to decrement the  

reference count when a pointer to the object is destructed.  One most  

(but not all platforms and apparently not Solaris prior to Solaris  

10), apr_atomic_dec32 simply delegates to a platform method or inline  

assembler.  On platforms without a native atomic decrement, APR  

implements apr_atomic_dec32 using APR mutexes which will only work if  

APR is properly initialized.  What appears to be happening in the  

crash is that APR has been terminated before the call to  

apr_atomic_dec32 and then apr_atomic_dec32 segfaults.

 

Possibly remedies would be:

 

1. If running Solaris 10, modify either APR or log4cxx to use  

atomic_inc and atomic_dec.

2. If contention is not an issue, replace the atomic decrement with a  

simple --ref.

3. Determine why APR is terminating before the last object is  

reclaimed.  It may be that APR is terminating earlier than expected on  

other platforms, it is just not noticed since apr_atomic_dec32 isn't  

dependent on APR being properly initialized on those platforms.

 

Version of Solaris, processor type, compiler vendor and versions, etc  

would be helpful.


Mime
View raw message