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 GregN <gr...@yahoo.com> on 2008/06/04 20:14:54 UTC

Re: Segmentation fault log4cxx 0.10.0 on app exit ( RH Linux)

I made changes you recommended in src/main/cpp/objectimpl.cpp but it
unfortunately didn't help.

It seems that #if statement is true

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

   __i386__ - defined
  __x86_64__ - NOT defined
  __GNUC__ - defined
  USE_GENERAL_ATOMICS - NOT defined
  (defined(__i386__) || defined(__x86_64__)) && defined(__GNUC__) &&
!defined(USE_GENERAL_ATOMICS) - defined

The stack is:
C++ [C/C++ Local Application]	
	gdb/mi (6/4/08 1:46 PM) (Suspended)	
		Thread [1] (Suspended: Signal 'SIGSEGV' received. Description:
Segmentation fault.)	
			27 apr_pool_create_ex()
/home/grn/Projects/apr-1.2.12/memory/unix/apr_pools.c:249 0xb7d22fb7	
			26 Pool()
/home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/pool.cpp:34 0xb7e47db7	
			25 log4cxx::helpers::IOException::formatMessage()
/home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/exception.cpp:149
0xb7df5176	
			24 IOException()
/home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/exception.cpp:130
0xb7df65f0	
			23 log4cxx::helpers::FileOutputStream::close()
/home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/fileoutputstream.cpp:71
0xb7dfef2a	
			22 log4cxx::rolling::CountingOutputStream::close()
/home/grn/Projects/apache-log4cxx-0.10.0/src/main/include/log4cxx/helpers/objectptr.h:157
0xb7e58102	
			21 log4cxx::helpers::OutputStreamWriter::close()
/home/grn/Projects/apache-log4cxx-0.10.0/src/main/include/log4cxx/helpers/objectptr.h:157
0xb7e3f278	
			20 log4cxx::WriterAppender::closeWriter()
/home/grn/Projects/apache-log4cxx-0.10.0/src/main/include/log4cxx/helpers/objectptr.h:157
0xb7e850b1	
			19 log4cxx::WriterAppender::close()
/home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/writerappender.cpp:143
0xb7e851cf	
			18 log4cxx::AppenderSkeleton::finalize()
/home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/appenderskeleton.cpp:80
0xb7dc8846	
			17 ~FileAppender()
/home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/fileappender.cpp:88
0xb7dfafd3	
			16 ~RollingFileAppenderSkeleton()
/home/grn/Projects/apache-log4cxx-0.10.0/src/main/include/log4cxx/helpers/objectptr.h:100
0xb7dddedc	
			15 ~RollingFileAppender()
/home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/obsoleterollingfileappender.cpp:87
0xb7e37c55	
			14 log4cxx::helpers::ObjectImpl::releaseRef()
/home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/objectimpl.cpp:84
0xb7e35e28	
			13 log4cxx::AppenderSkeleton::releaseRef()
/home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/appenderskeleton.cpp:68
0xb7dc8819	
			12 ~ObjectPtrT()
/home/grn/Projects/apache-log4cxx-0.10.0/src/main/include/log4cxx/helpers/objectptr.h:100
0xb7dc799c	
			11 ~AppenderAttachableImpl()
/usr/include/c++/3.4.3/bits/stl_construct.h:107 0xb7dc852c	
			10 log4cxx::helpers::ObjectImpl::releaseRef()
/home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/objectimpl.cpp:84
0xb7e35e28	
			9 log4cxx::helpers::AppenderAttachableImpl::releaseRef()
/home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/appenderattachableimpl.cpp:41
0xb7dc6bcd	
			8 ~Logger()
/home/grn/Projects/apache-log4cxx-0.10.0/src/main/include/log4cxx/helpers/objectptr.h:100
0xb7e2065c	
			7 log4cxx::helpers::ObjectImpl::releaseRef()
/home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/objectimpl.cpp:84
0xb7e35e28	
			6 log4cxx::Logger::releaseRef()
/home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/logger.cpp:62
0xb7e1fc65	
			5 ~ObjectPtrT() /usr/local/include/log4cxx/helpers/objectptr.h:100
0x080550e3	
			4 __tcf_1() /home/grn/Projects/C++/..project related.. 0x08083e91	
			3 exit()  0x004ce467	
			2 __libc_start_main()  0x004b8e2d	
			1 _start()  0x080545ad	

-- 
View this message in context: http://www.nabble.com/Segmentation-fault-log4cxx-0.10.0-on-app-exit-%28-RH-Linux%29-tp17543738p17653096.html
Sent from the Log4cxx - Users mailing list archive at Nabble.com.


Re: Segmentation fault log4cxx 0.10.0 on app exit ( RH Linux)

Posted by GregN <gr...@yahoo.com>.

>Without the fix, does "make check" successfully run the unit tests.
Seems all tests passed with SUCCESS.
I saved the log if you want it.

>What specific RedHat are you running... 
It is Enterprise RH (probably 4.3)
[grn@gredhat4 ~]$ uname -a
Linux gredhat4 2.6.9-11.EL #1 Fri May 20 18:17:57 EDT 2005 i686 i686 i386
GNU/Linux
[grn@gredhat4 ~]$ Linux gredhat4 2.6.9-11.EL #1 Fri May 20 18:17:57 EDT 2005
i686 i686 i386 GNU/Linux


>Could you see if using a current gcc would eliminate the problem.   
Sorry, I can't switch to latest gcc at this moment.

-- 
View this message in context: http://www.nabble.com/Segmentation-fault-log4cxx-0.10.0-on-app-exit-%28-RH-Linux%29-tp17543738p17758305.html
Sent from the Log4cxx - Users mailing list archive at Nabble.com.


Re: Segmentation fault log4cxx 0.10.0 on app exit ( RH Linux)

Posted by Curt Arnold <ca...@apache.org>.
On Jun 6, 2008, at 10:07 AM, GregN wrote:

>
>> As a work around until a resolution, you could try commenting out the
>> apr_terminate() call in src/main/cpp/aprinitializer.cpp.
>
> It works with this change.
> Let me know if I can help you to fix the problem.
> THanks..
>

Without the fix, does "make check" successfully run the unit tests.

What specific RedHat are you running, is it a RHEL or a Fedora and  
what version?  I don't have access to RHEL, but do have CentOS VM's  
that I can fire up.

Could you see if using a current gcc would eliminate the problem.   
There have been reported bugs with static deinitialization in gcc (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24472 
), I believe there have been others, but couldn't find them in the gcc  
Bugzilla.



Re: Segmentation fault log4cxx 0.10.0 on app exit ( RH Linux)

Posted by GregN <gr...@yahoo.com>.
>As a work around until a resolution, you could try commenting out the  
>apr_terminate() call in src/main/cpp/aprinitializer.cpp.

It works with this change.
Let me know if I can help you to fix the problem.
THanks..

-- 
View this message in context: http://www.nabble.com/Segmentation-fault-log4cxx-0.10.0-on-app-exit-%28-RH-Linux%29-tp17543738p17694419.html
Sent from the Log4cxx - Users mailing list archive at Nabble.com.


Re: Segmentation fault log4cxx 0.10.0 on app exit ( RH Linux)

Posted by Curt Arnold <ca...@apache.org>.
On Jun 4, 2008, at 1:14 PM, GregN wrote:

>
> I made changes you recommended in src/main/cpp/objectimpl.cpp but it
> unfortunately didn't help.
>
> It seems that #if statement is true
>
> #if (defined(__i386__) || defined(__x86_64__)) && defined(__GNUC__)
> && !defined(USE_GENERAL_ATOMICS)
>
>   __i386__ - defined
>  __x86_64__ - NOT defined
>  __GNUC__ - defined
>  USE_GENERAL_ATOMICS - NOT defined
>  (defined(__i386__) || defined(__x86_64__)) && defined(__GNUC__) &&
> !defined(USE_GENERAL_ATOMICS) - defined
>

The previous stack trace suggested that the expression was false.


> The stack is:
> C++ [C/C++ Local Application]	
> 	gdb/mi (6/4/08 1:46 PM) (Suspended)	
> 		Thread [1] (Suspended: Signal 'SIGSEGV' received. Description:
> Segmentation fault.)	
> 			27 apr_pool_create_ex()
> /home/grn/Projects/apr-1.2.12/memory/unix/apr_pools.c:249 0xb7d22fb7	
> 			26 Pool()
> /home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/pool.cpp:34  
> 0xb7e47db7	
> 			25 log4cxx::helpers::IOException::formatMessage()
> /home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/exception.cpp: 
> 149
> 0xb7df5176	
> 			24 IOException()
> /home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/exception.cpp: 
> 130
> 0xb7df65f0	
> 			23 log4cxx::helpers::FileOutputStream::close()
> /home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/ 
> fileoutputstream.cpp:71
> 0xb7dfef2a	
> 			22 log4cxx::rolling::CountingOutputStream::close()
> /home/grn/Projects/apache-log4cxx-0.10.0/src/main/include/log4cxx/ 
> helpers/objectptr.h:157
> 0xb7e58102	
> 			21 log4cxx::helpers::OutputStreamWriter::close()
> /home/grn/Projects/apache-log4cxx-0.10.0/src/main/include/log4cxx/ 
> helpers/objectptr.h:157
> 0xb7e3f278	
> 			20 log4cxx::WriterAppender::closeWriter()
> /home/grn/Projects/apache-log4cxx-0.10.0/src/main/include/log4cxx/ 
> helpers/objectptr.h:157
> 0xb7e850b1	
> 			19 log4cxx::WriterAppender::close()
> /home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/ 
> writerappender.cpp:143
> 0xb7e851cf	
> 			18 log4cxx::AppenderSkeleton::finalize()
> /home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/ 
> appenderskeleton.cpp:80
> 0xb7dc8846	
> 			17 ~FileAppender()
> /home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/ 
> fileappender.cpp:88
> 0xb7dfafd3	
> 			16 ~RollingFileAppenderSkeleton()
> /home/grn/Projects/apache-log4cxx-0.10.0/src/main/include/log4cxx/ 
> helpers/objectptr.h:100
> 0xb7dddedc	
> 			15 ~RollingFileAppender()
> /home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/ 
> obsoleterollingfileappender.cpp:87
> 0xb7e37c55	
> 			14 log4cxx::helpers::ObjectImpl::releaseRef()
> /home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/objectimpl.cpp: 
> 84
> 0xb7e35e28	
> 			13 log4cxx::AppenderSkeleton::releaseRef()
> /home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/ 
> appenderskeleton.cpp:68
> 0xb7dc8819	
> 			12 ~ObjectPtrT()
> /home/grn/Projects/apache-log4cxx-0.10.0/src/main/include/log4cxx/ 
> helpers/objectptr.h:100
> 0xb7dc799c	
> 			11 ~AppenderAttachableImpl()
> /usr/include/c++/3.4.3/bits/stl_construct.h:107 0xb7dc852c	
> 			10 log4cxx::helpers::ObjectImpl::releaseRef()
> /home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/objectimpl.cpp: 
> 84
> 0xb7e35e28	
> 			9 log4cxx::helpers::AppenderAttachableImpl::releaseRef()
> /home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/ 
> appenderattachableimpl.cpp:41
> 0xb7dc6bcd	
> 			8 ~Logger()
> /home/grn/Projects/apache-log4cxx-0.10.0/src/main/include/log4cxx/ 
> helpers/objectptr.h:100
> 0xb7e2065c	
> 			7 log4cxx::helpers::ObjectImpl::releaseRef()
> /home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/objectimpl.cpp: 
> 84
> 0xb7e35e28	
> 			6 log4cxx::Logger::releaseRef()
> /home/grn/Projects/apache-log4cxx-0.10.0/src/main/cpp/logger.cpp:62
> 0xb7e1fc65	
> 			5 ~ObjectPtrT() /usr/local/include/log4cxx/helpers/objectptr.h:100
> 0x080550e3	
> 			4 __tcf_1() /home/grn/Projects/C++/..project related.. 0x08083e91	
> 			3 exit()  0x004ce467	
> 			2 __libc_start_main()  0x004b8e2d	
> 			1 _start()  0x080545ad	
>

This stack trace is different since it doesn't die in  
apr_atomic_dec32, but the underlying problem is still the same, APR is  
terminated prematurely during destruction of static variables.  I have  
spent a little time trying to reproduce this issue, but haven't  
succeeded yet.

As a work around until a resolution, you could try commenting out the  
apr_terminate() call in src/main/cpp/aprinitializer.cpp.