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 "Allen Liu (allliu)" <al...@cisco.com> on 2008/06/10 03:05:04 UTC

Re: Segmentation fault log4cxx 0.10.0 on app exit (Solaris 8)

Hi Curt,
 
I compiled log4cxx-0.10.0 with gcc on 3 Solaris 8/sparc workstations, 2
of which were installed with apr/apr-util 1.2.12 whereas the other
apr/apr-util1.2.7.
 
Before applying the objectimpl.cpp workaround you provided, 
 
1. 'make check' would fail on unit-test with exit status 139
2. a small test program I wrote got segmentation fault on exit
 
After applying your workaround,
 
1. 'make check' passed on all 3 machine
2. my small test program still exited with 'segmentation fault' on the 2
machine installed with apr/apr-util 1.2.12. But it exited without a
problem on the 3rd machine (with apr 1.2.7)
 
Then I replaced apr/apr-util 1.2.12 with 1.2.7 on those 2 sun machines,
 
1. 'make check' passed
2. my small test program exited without 'segmentation fault' on all 3
machines
 
 
I got the following question:
1. I got an impression from other posts that apr/apr-util 1.2.2 are
officially used by log4cxx developers. Do I have to use 1.2.2? Or 1.2.7
should be fine?
2. Will there be a permanent fix to replace the workaround solution you
provided in objectimpl.cpp?
 
Thanks,
Allen

RE: Segmentation fault log4cxx 0.10.0 on app exit (Solaris 8)

Posted by "Allen Liu (allliu)" <al...@cisco.com>.
> -----Original Message-----
> From: Jostein Tveit [mailto:josteitv@pvv.ntnu.no] 
> Sent: Tuesday, June 10, 2008 3:30 PM
> To: Log4CXX User
> Subject: Re: Segmentation fault log4cxx 0.10.0 on app exit (Solaris 8)
> 
> "Allen Liu (allliu)" <al...@cisco.com> writes:
> 
> > Initially, I used gcc 3.4.6 (from sunfreeware.com) and got unittest 
> > failure with 'make check'.
> > Then I switched to gcc 4.2.3 but it didn't help.
> 
> I have successfully compiled log4cxx 0.10.0 on Solaris 8 
> SPARC with Sun Stuio 11.
> 
> You may want to try the Sun compiler which can be downloaded 
> free of charge from sun.com.
> 
> --
> Jostein Tveit <jo...@pvv.ntnu.no>
> 

Thanks! I can compile successfully, too, with gcc. 
But I wonder if you can run either 'make check' or applications without
any problem?

Re: Segmentation fault log4cxx 0.10.0 on app exit (Solaris 8)

Posted by Jostein Tveit <jo...@pvv.ntnu.no>.
"Allen Liu (allliu)" <al...@cisco.com> writes:

> Initially, I used gcc 3.4.6 (from sunfreeware.com) and got unittest
> failure with 'make check'.
> Then I switched to gcc 4.2.3 but it didn't help.

I have successfully compiled log4cxx 0.10.0 on Solaris 8 SPARC
with Sun Stuio 11.

You may want to try the Sun compiler which can be downloaded free
of charge from sun.com.

-- 
Jostein Tveit <jo...@pvv.ntnu.no>

RE: Segmentation fault log4cxx 0.10.0 on app exit (Solaris 8)

Posted by "Allen Liu (allliu)" <al...@cisco.com>.
 

> -----Original Message-----
> From: Curt Arnold [mailto:carnold@apache.org] 
> Sent: Monday, June 09, 2008 11:47 PM
> To: Log4CXX User
> Subject: Re: Segmentation fault log4cxx 0.10.0 on app exit (Solaris 8)
> 
> 
> It would be helpful to know the versions of gcc in use and 
> whether the problems occur when using the most recent gcc release.
> 

Initially, I used gcc 3.4.6 (from sunfreeware.com) and got unittest
failure with 'make check'.
Then I switched to gcc 4.2.3 but it didn't help.

AW: Segmentation fault log4cxx 0.10.0 on app exit (Solaris 8)

Posted by Lars Tetzlaff <lt...@markstein.com>.
Hi

> -----Ursprungliche Nachricht-----
> Von: Curt Arnold [mailto:carnold@apache.org]
> Gesendet: Dienstag, 10. Juni 2008 08:47
> An: Log4CXX User
> Betreff: Re: Segmentation fault log4cxx 0.10.0 on app exit (Solaris 8)
>
>
>
> On Jun 9, 2008, at 8:05 PM, Allen Liu (allliu) wrote:
>
> > Hi Curt,
> >
> > I compiled log4cxx-0.10.0 with gcc on 3 Solaris 8/sparc
> > workstations, 2 of which were installed with apr/apr-util 1.2.12
> > whereas the other apr/apr-util1.2.7.
> >
> > Before applying the objectimpl.cpp workaround you provided,
> >
> > 1. 'make check' would fail on unit-test with exit status 139
> > 2. a small test program I wrote got segmentation fault on exit
> >
> > After applying your workaround,
> >
> > 1. 'make check' passed on all 3 machine
> > 2. my small test program still exited with 'segmentation fault' on
> > the 2 machine installed with apr/apr-util 1.2.12. But it exited
> > without a problem on the 3rd machine (with apr 1.2.7)
> >
> > Then I replaced apr/apr-util 1.2.12 with 1.2.7 on those 2 sun
> > machines,
> >
> > 1. 'make check' passed
> > 2. my small test program exited without 'segmentation fault' on all
> > 3 machines
> >
> >
> > I got the following question:
> > 1. I got an impression from other posts that apr/apr-util 1.2.2 are
> > officially used by log4cxx developers. Do I have to use 1.2.2? Or
> > 1.2.7 should be fine?
> > 2. Will there be a permanent fix to replace the workaround solution
> > you provided in objectimpl.cpp?
> >
> > Thanks,
> > Allen
>
>
> The reason for the premature termination of APR hasn't been
> identified: it may be a compiler bug or an log4cxx issue.  The best
> workaround for now appears to be commenting out the apr_terminate() in
> src/main/cpp/aprinitialzer.cpp.  However, removing the apr_terminate
> call would result in more reported memory leaking from tools like
> Valgrind.  Until the nature of the underlying premature destruction of
> APRInitializer is known, their can't be a reasonable fix.
>

I have the same problem on Mac OS X. Commenting out the apr_terminate() does
the job. Genarally it is a bug in log4cxx. There should not be any call to
the statically initialized aprinitialzer in a destructor of any nonlocal
object since the order of destruction of such objects in different
compilation units is *undefined* (see "The C++ Programming Language", third
edition p. 252). If the call to aprinitialzer is needed, you can't make
valgrind happy ;)


Lars


Re: Segmentation fault log4cxx 0.10.0 on app exit (Solaris 8)

Posted by Curt Arnold <ca...@apache.org>.
On Jun 9, 2008, at 8:05 PM, Allen Liu (allliu) wrote:

> Hi Curt,
>
> I compiled log4cxx-0.10.0 with gcc on 3 Solaris 8/sparc  
> workstations, 2 of which were installed with apr/apr-util 1.2.12  
> whereas the other apr/apr-util1.2.7.
>
> Before applying the objectimpl.cpp workaround you provided,
>
> 1. 'make check' would fail on unit-test with exit status 139
> 2. a small test program I wrote got segmentation fault on exit
>
> After applying your workaround,
>
> 1. 'make check' passed on all 3 machine
> 2. my small test program still exited with 'segmentation fault' on  
> the 2 machine installed with apr/apr-util 1.2.12. But it exited  
> without a problem on the 3rd machine (with apr 1.2.7)
>
> Then I replaced apr/apr-util 1.2.12 with 1.2.7 on those 2 sun  
> machines,
>
> 1. 'make check' passed
> 2. my small test program exited without 'segmentation fault' on all  
> 3 machines
>
>
> I got the following question:
> 1. I got an impression from other posts that apr/apr-util 1.2.2 are  
> officially used by log4cxx developers. Do I have to use 1.2.2? Or  
> 1.2.7 should be fine?
> 2. Will there be a permanent fix to replace the workaround solution  
> you provided in objectimpl.cpp?
>
> Thanks,
> Allen


The reason for the premature termination of APR hasn't been  
identified: it may be a compiler bug or an log4cxx issue.  The best  
workaround for now appears to be commenting out the apr_terminate() in  
src/main/cpp/aprinitialzer.cpp.  However, removing the apr_terminate  
call would result in more reported memory leaking from tools like  
Valgrind.  Until the nature of the underlying premature destruction of  
APRInitializer is known, their can't be a reasonable fix.

It would be helpful to know the versions of gcc in use and whether the  
problems occur when using the most recent gcc release.

Apache log4cxx 0.10.0 was built and tested against APR 1.2.11.  There  
were some issues with APR 1.2.12 on VC6 without a Platform SDK  
update.  The intent is that future releases will be built and tested  
using the current APR release.  Nothing should prevent you from using  
log4cxx with earlier APR 1.x releases, but they aren't tested or  
supported.