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.

Reply via email to