You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Unnikrishnan Udinoor <uu...@Brocade.COM> on 2008/04/29 21:10:43 UTC
Core dump in Solaris - log4cxx 0.10.0 Sample Program.
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.
Details:
I compiled the sample log4cxx program given under "Configuration"
section ( http://logging.apache.org/log4cxx/index.html
<http://logging.apache.org/log4cxx/index.html> ) on Solaris and its
getting Segmentation fault during exit() of program. It could be due to
order of constructor/destructor and exit() calls. Same program is
working well under Red Hat Linux. I used latest release version of
log4cxx
0.10.
Here is the log:
sol10-116200# cat MyApp.cpp
// include log4cxx header files.
#include "log4cxx/logger.h"
#include "log4cxx/basicconfigurator.h"
#include "log4cxx/helpers/exception.h"
using namespace log4cxx;
using namespace log4cxx::helpers;
LoggerPtr logger(Logger::getLogger("MyApp"));
int main(int argc, char **argv)
{
int result = EXIT_SUCCESS;
try
{
// Set up a simple configuration that logs on the console.
BasicConfigurator::configure();
LOG4CXX_INFO(logger, "Entering application.");
LOG4CXX_INFO(logger, "Exiting application.");
}
catch(Exception&)
{
result = EXIT_FAILURE;
}
return result;
}
sol10-116200# ls /sample/log4cxx/include /sample/log4cxx/lib
/sample/log4cxx/include:
log4cxx
/sample/log4cxx/lib:
apr.exp libaprutil-1.la <http://libaprutil-1.la>
libexpat.so <http://libexpat.so> .0.1.0
aprutil.exp libaprutil-1.so <http://libaprutil-1.so>
liblog4cxx.a
libapr-1.a libaprutil-1.so <http://libaprutil-1.so> .0
liblog4cxx.la <http://liblog4cxx.la>
libapr-1.la <http://libapr-1.la> libaprutil-1.so
<http://libaprutil-1.so> .0.2.12 liblog4cxx.so <http://liblog4cxx.so>
libapr-1.so <http://libapr-1.so> libexpat.a liblog4cxx.so.10
<http://liblog4cxx.so.10libapr-1.so>
<http://liblog4cxx.so.10libapr-1.so> libapr-1.so.0 libexpat.la
<http://libexpat.la> liblog4cxx.so.10.0.0
<http://liblog4cxx.so.10.0.0libapr-1.so>
libapr-1.so <http://liblog4cxx.so.10.0.0libapr-1.so> .0.2.12
libexpat.so <http://libexpat.so>
libaprutil-1.a libexpat.so <http://libexpat.so> .0
sol10-116200#
sol10-116200#
sol10-116200#
sol10-116200# /usr/sfw/bin/g++ -I/sample/log4cxx/include MyApp.cpp -lnsl
-lrt -lsendfile -lsocket -lpthread -L/sample/log4cxx/lib -llog4cxx
-laprutil-1 -lapr-1 -lexpat
sol10-116200# env | grep LD_LIBRARY_PATH
LD_LIBRARY_PATH=/opt/Netscape/dist/lib
sol10-116200# LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/sample/log4cxx/lib
export LD_LIBRARY_PATH
sol10-116200# env | grep LD_LIBRARY_PATH
LD_LIBRARY_PATH=/opt/Netscape/dist/lib:/sample/log4cxx/lib
sol10-116200# ./a.out
0 [0x1] INFO MyApp null - Entering application.
1 [0x1] INFO MyApp null - Exiting application.
Segmentation Fault - core dumped
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 <http://ld.so> .1
Reading libnsl.so <http://libnsl.so> .1
Reading librt.so <http://librt.so> .1
Reading libsendfile.so <http://libsendfile.so> .1
Reading libsocket.so <http://libsocket.so> .1
Reading libpthread.so <http://libpthread.so> .1
Reading liblog4cxx.so <http://liblog4cxx.so> .10
Reading libaprutil-1.so <http://libaprutil-1.so> .0
Reading libapr-1.so <http://libapr-1.so> .0
Reading libexpat.so <http://libexpat.so> .0
Reading libstdc++.so.6.0.3
Reading libm.so <http://libm.so> .2
Reading libgcc_s.so <http://libgcc_s.so> .1
Reading libc.so <http://libc.so> .1
Reading libaio.so <http://libaio.so> .1
Reading libmd.so <http://libmd.so> .1
Reading libuuid.so <http://libuuid.so> .1
Reading libc_psr.so <http://libc_psr.so> .1
t@1 (l@1) program terminated by signal SEGV (no mapping at the fault
address)
Current function is apr_atomic_dec32
310 apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)];
(dbx) where
current thread: t@1
=>[1] apr_atomic_dec32(mem = 0x31d0c), line 310 in "apr_atomic.c"
[2] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x31d08), line 44
in "objectimpl.cpp"
[3]
log4cxx::helpers::ObjectPtrT<log4cxx::Logger>::~ObjectPtrT(0x221ec,
0x29c10, 0x1, 0x0, 0x4, 0xffff), at 0x1192c
[4] __static_initialization_and_destruction_0(0x0, 0xffff,
0xff0bcfe8, 0x0, 0xff3f42e8, 0x0), at 0x116d0
[5] _GLOBAL__D_logger(0x110, 0x0, 0x0, 0xff, 0x0, 0x11708), at
0x11718
[6] __do_global_dtors_aux(0xfecf42c0, 0x0, 0x0, 0x0, 0x0,
0xff342000), at 0x10ff8
[7] _fini(0x1, 0x1084, 0xfebc1840, 0x0, 0xff342000, 0x1000), at
0x117ac
[8] _exithandle(0xfecf4540, 0xfebc16c0, 0xfecf3580, 0x34930, 0x4,
0xffbffbb0), at 0xfec418dc
[9] exit(0x0, 0xffbffc4c, 0xffbffc54, 0x2222c, 0xfebc16c0,
0xfebc1700), at 0xfec301f0
(dbx) run
dbx: internal warning: td_ta_clear_event() failed -- debugger service
failed
dbx: internal warning: td_ta_sync_tracking_enable(0) failed -- debugger
service failed
Running: a.out
(process id 1675)
1 [0x1] INFO MyApp null - Entering application.
1 [0x1] INFO MyApp null - Exiting application.
t@1 (l@1) signal SEGV (no mapping at the fault address) in
apr_atomic_dec32 at line 310 in file "apr_atomic.c"
310 apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)];
(dbx) where
current thread: t@1
=>[1] apr_atomic_dec32(mem = 0x31d0c), line 310 in "apr_atomic.c"
[2] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x31d08), line 44
in "objectimpl.cpp"
[3]
log4cxx::helpers::ObjectPtrT<log4cxx::Logger>::~ObjectPtrT(0x221ec,
0x0, 0x0, 0x0, 0xfecf42c0, 0xffff), at 0x1192c
[4] __static_initialization_and_destruction_0(0x0, 0xffff, 0x0, 0x0,
0xfecf42c0, 0xffff8000), at 0x116d0
[5] _GLOBAL__D_logger(0xff000000, 0x0, 0xff000000, 0xff000000, 0x0,
0x11708), at 0x11718
[6] __do_global_dtors_aux(0x0, 0x3012c44a, 0xff000000, 0x0,
0xfebb0050, 0x0), at 0x10ff8
[7] _fini(0x1, 0x1084, 0xfeb41840, 0x0, 0xff342000, 0x1000), at
0x117ac
[8] _exithandle(0xfecf4540, 0xfeb416c0, 0xfecf3580, 0x34930, 0x0,
0xffbffb60), at 0xfec418dc
[9] exit(0x0, 0xffbffbfc, 0xffbffc04, 0x2222c, 0xfeb416c0,
0xfeb41700), at 0xfec301f0
(dbx) quit
sol10-116200#
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#
The program will work perfectly if I moved the line "LoggerPtr
logger(Logger::getLogger("MyApp"));" inside main.
This model was working well with previous version log4cxx-r603007. I am
planning to upgrade the log4cxx to release 0.10.
We have defined "LoggerPtr logger(Logger::getLogger("MyApp"));" outside
of main in out application and its difficult to change our application
at this point.
Is there any way for making it work on Solaris without modifying the
example program? Let me know if you need more information.
I appreciate your help.
Regards,
Unnikrishnan
Re: Core dump in Solaris - log4cxx 0.10.0 Sample Program.
Posted by Curt Arnold <ca...@apache.org>.
On May 6, 2008, at 12:49 PM, Unnikrishnan Udinoor wrote:
> Hi,
> We still don’t have a solution yet for this problem.
> Can someone give some idea/ tips for fixing this issue.
>
> Regards
> Unni
I spent some time yesterday and today building a VM for OpenSolaris
2008.05. I was able to build and test log4cxx using Sun Studio 11 in
my VirtualBox VM on Mac and was able to fix some of the reported
compiler warnings on Solaris before I had to do a hard restart of my
host machine and lost that VM. I thought it best to fix all the
easily addressed previously reported Solaris issues just in case one
of them was responsible. I haven't finished them all, but I don't
think that is likely at this point. I'm trying to rebuild a VM
(trying VMWare this time) and will try a gcc build, but will be likely
18 hours or so from now.
Could you do the following:
If you built your own apr and apr-util, provide the results on "make
check". I saw some failures when I ran that on OpenSolaris 2008.05,
but they didn't seem to be in parts of APR that we use. However, it
you get a different set of failures that I do, then that might be a
problem.
Run "make check" on an unmodified log4cxx (either 0.10.0 or SVN HEAD)
and report the results.
Run the trivial sample program (src/examples/cpp/trivial) and report
the results. That program should be pretty similar to your sample
program and if trivial runs and your sample fails then should look at
the differences between the apps.
If you have access to a comparable Solaris on x86 or x86_64, do you
have the same failures or is it Sparc-specific.
Probably should file a bug report and add the reports as attachments.
RE: Core dump in Solaris - log4cxx 0.10.0 Sample Program.
Posted by Unnikrishnan Udinoor <uu...@Brocade.COM>.
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.
RE: Core dump in Solaris - log4cxx 0.10.0 Sample Program.
Posted by Unnikrishnan Udinoor <uu...@Brocade.COM>.
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.
Re: Core dump in Solaris - log4cxx 0.10.0 Sample Program.
Posted by Curt Arnold <ca...@apache.org>.
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.