Uploaded image for project: 'Log4cxx'
  1. Log4cxx
  2. LOGCXX-289

In Solaris Sparc - Using log4cxx.0.10.0 Sample program is crashing on Exit.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Duplicate
    • 0.10.0
    • None
    • Core
    • None

    Description

      Since log4cxx 0.10.0 is core dumping on exit, we are unable to use it for the application.
      The detailed steps are pasted down. Please get back to me for more info.

      The mailing list has this issue being discussed -
      http://mail-archives.apache.org/mod_mbox/logging-log4cxx-user/200804.mbox/ajax/%3cEB4C465FC146B54DAADF4C8C0637BC6202BA6C6D@HQ-EXCH-4.corp.brocade.com%3e

      Steps Followed:
      --------------------
      1) Downloaded the log4cxx 0.10.0 version and compiled with apr, apr-util 1.2.12.
      2) The following Sample code is compiled with the above library -

      ==========================================================
      #include "log4cxx/logger.h"
      #include "log4cxx/basicconfigurator.h"
      #include "log4cxx/propertyconfigurator.h"
      #include "log4cxx/helpers/exception.h"

      using namespace log4cxx;
      using namespace log4cxx::helpers;

      static 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(); // LoggerPtr logger = Logger::getLogger("MyApp"); log4cxx::File cfgFile(AGT_LOG4CXX_CFG_FILE); log4cxx::PropertyConfigurator::configure(cfgFile); LOG4CXX_INFO(logger, "Entering application."); LOG4CXX_INFO(logger, "Exiting application."); }

      catch(Exception&)

      { result = EXIT_FAILURE; }

      return result;
      }

      ==========================================================
      3) execute the binary - the output is as follows.
      ./a.out
      16:36:33,706 [0x1] INFO MyApp:27 - Entering application.
      16:36:33,707 [0x1] INFO MyApp:28 - Exiting application.
      Segmentation Fault (core dumped)

      4) If we try with the logger declaration with in the main(Comment the global declaration and uncomment the local declaration) - then this application works fine. It doenst core dump.

      5) the core file genereated shows as follows -
      ===============================================================
      sol10-116200# dbx crash.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 crash.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) terminated by signal SEGV (no mapping at the fault address)
      0xfef8381c: apr_atomic_dec32+0x0048: ld [%g1], %g1
      Current function is log4cxx::helpers::ObjectImpl::releaseRef
      48 }
      (dbx) where
      current thread: t@1
      [1] apr_atomic_dec32(0x31edc, 0x0, 0xff000000, 0xff000000, 0x0, 0x1d), at 0xfef8381c
      =>[2] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x31ed8), line 48 in "objectimpl.cpp"
      [3] log4cxx::helpers::ObjectPtrT<log4cxx::Logger>::~ObjectPtrT(0x223bc, 0x27dd8, 0xfef8f234, 0x0, 0xff3f42e8, 0xffff), at 0x11ab0
      [4] __static_initialization_and_destruction_0(0x0, 0xffff, 0xff0bcfe8, 0x0, 0xff3f42e8, 0xfefb4b54), at 0x11854
      [5] GLOBAL_D_main(0xff000000, 0x0, 0xff000000, 0xff000000, 0x0, 0x1188c), at0x1189c
      [6] __do_global_dtors_aux(0x0, 0x0, 0xff000000, 0x0, 0x0, 0xff342000), at 0x110ac
      [7] _fini(0x1, 0x1084, 0xfeb82080, 0x0, 0xff342000, 0x1000), at 0x11930
      [8] _exithandle(0xfecf4540, 0xfeb816c0, 0xfecf3580, 0x34da8, 0x4, 0xffbffbd0),at 0xfec418dc
      [9] exit(0x0, 0xffbffc74, 0xffbffc7c, 0x223fc, 0xfeb816c0, 0xfeb81700), at 0xfec301f0

      ==================================================================

      6) After that tried the following changes in the main/cpp/objectimpr.cpp file as mentioned in the email thread - http://mail-archives.apache.org/mod_mbox/logging-log4cxx-user/200805.mbox/ajax/%3c1D87CEEC-A657-4FE2-8546-5B92A222E4A8@apache.org%3e

      the core dump looks like this

      ==================================================================
      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.0.0
      Reading libaprutil-1.so.0.2.12
      Reading libapr-1.so.0.2.12
      Reading libexpat.so.0.1.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) terminated by signal SEGV (no mapping at the fault address)
      Current function is apr_atomic_xchg32
      365 apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)];
      (dbx) where
      current thread: t@1
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      =>[1] apr_atomic_xchg32(mem = 0xffbff300, val = 0), line 365 in "apr_atomic.c"
      [2] log4cxx::WriterAppender::closeWriter(this = 0x34c70), line 171 in "objectptr.h"
      [3] log4cxx::WriterAppender::close(this = 0x34c70), line 143 in "writerappender.cpp"
      [4] log4cxx::AppenderSkeleton::finalize(this = 0x34c70), line 80 in "appenderskeleton.cpp"
      [5] log4cxx::ConsoleAppender::~ConsoleAppender(this = 0x34c70), line 57 in "consoleappender.cpp"
      [6] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x34cc4), line 48 in "objectimpl.cpp"
      [7] log4cxx::helpers::ObjectPtrT<log4cxx::Appender>::~ObjectPtrT(this = 0x22ec0), line 100 in "objectptr.h"
      [8] log4cxx::helpers::AppenderAttachableImpl::~AppenderAttachableImpl(this = 0x34e98), line 107 in "stl_construct.h"
      [9] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x34eac), line 48 in "objectimpl.cpp"
      [10] log4cxx::Logger::~Logger(this = 0x31e58), line 100 in "objectptr.h"
      [11] log4cxx::spi::RootLogger::~RootLogger(this = 0x31e58), line 48 in "rootlogger.cpp"
      [12] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x31e90), line 48 in "objectimpl.cpp"
      [13] log4cxx::Logger::~Logger(this = 0x31ea0), line 100 in "objectptr.h"
      [14] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x31ed8), line 48 in "objectimpl.cpp"
      [15] log4cxx::helpers::ObjectPtrT<log4cxx::Logger>::~ObjectPtrT(0x223bc, 0x19,0x98208, 0xfec56998, 0x14, 0xffff), at 0x11ab0
      [16] __static_initialization_and_destruction_0(0x0, 0xffff, 0xff000000, 0xff000000, 0x0, 0x14), at 0x11854
      [17] GLOBAL_D_main(0xff000000, 0x0, 0xff000000, 0xff000000, 0x0, 0x1188c), at 0x1189c
      [18] __do_global_dtors_aux(0x0, 0x0, 0xff000000, 0x0, 0x0, 0xff342000), at 0x110ac
      [19] _fini(0x1, 0x1084, 0xfebc2080, 0x0, 0xff342000, 0x1000), at 0x11930
      [20] _exithandle(0xfecf4540, 0xfebc16c0, 0xfecf3580, 0x34da8, 0x4, 0xffbffbb8), at 0xfec418dc
      [21] exit(0x0, 0xffbffc5c, 0xffbffc64, 0x223fc, 0xfebc16c0, 0xfebc1700), at 0xfec301f0
      (dbx)

      ==================================================================

      7) After that I commented the apr_atomic_xchg32() call from the src/main/cpp/objectptr.cpp and made it to execute the #else - still the application coredumps
      ==================================================================
      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.0.0
      Reading libaprutil-1.so.0.2.12
      Reading libapr-1.so.0.2.12
      Reading libexpat.so.0.1.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 apr_pool_create_ex
      249 if ((*ref = node->next) == NULL && i >= max_index) {
      (dbx) where
      current thread: t@1
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: forward reference `Pool' not defined, see `help forwardref'
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      dbx: internal warning: Visiting state accessed while locked
      =>[1] apr_pool_create_ex(newpool = 0xffbff058, parent = 0x2bd90, abort_fn = (nil), allocator = 0x27cf8), line 249 in "apr_pools.c"
      [2] log4cxx::helpers::Pool::Pool(this = 0xffbff058), line 34 in "pool.cpp"
      [3] log4cxx::helpers::IOException::formatMessage(stat = 9), line 149 in "exception.cpp"
      [4] log4cxx::helpers::IOException::IOException(this = 0x3c778, stat = 9), line130 in "exception.cpp"
      [5] log4cxx::helpers::FileOutputStream::close(this = 0x251b0, , line 71 in "fileoutputstream.cpp"
      [6] log4cxx::rolling::CountingOutputStream::close(this = 0x25110, p = STRUCT),line 157 in "objectptr.h"
      [7] log4cxx::helpers::OutputStreamWriter::close(this = 0x25350, p = STRUCT), line 157 in "objectptr.h"
      [8] log4cxx::WriterAppender::closeWriter(this = 0x3ba80), line 157 in "objectptr.h"
      [9] log4cxx::WriterAppender::close(this = 0x3ba80), line 143 in "writerappender.cpp"
      [10] log4cxx::AppenderSkeleton::finalize(this = 0x3ba80), line 80 in "appenderskeleton.cpp"
      [11] log4cxx::FileAppender::~FileAppender(this = 0x3ba80), line 88 in "fileappender.cpp"
      [12] log4cxx::rolling::RollingFileAppenderSkeleton::~RollingFileAppenderSkeleton(this = 0x3ba80), line 100 in "objectptr.h"
      [13] log4cxx::RollingFileAppender::~RollingFileAppender(this = 0x3ba80), line 87 in "obsoleterollingfileappender.cpp"
      [14] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x3bafc), line 48 in "objectimpl.cpp"
      [15] log4cxx::helpers::ObjectPtrT<log4cxx::Appender>::~ObjectPtrT(this = 0x22e58), line 100 in "objectptr.h"
      [16] log4cxx::helpers::AppenderAttachableImpl::~AppenderAttachableImpl(this = 0x34e00), line 107 in "stl_construct.h"
      [17] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x34e14), line 48 in "objectimpl.cpp"
      [18] log4cxx::Logger::~Logger(this = 0x31de8), line 100 in "objectptr.h"
      [19] log4cxx::spi::RootLogger::~RootLogger(this = 0x31de8), line 48 in "rootlogger.cpp"
      [20] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x31e20), line 48 in "objectimpl.cpp"
      [21] log4cxx::Logger::~Logger(this = 0x31e30), line 100 in "objectptr.h"
      [22] log4cxx::helpers::ObjectImpl::releaseRef(this = 0x31e68), line 48 in "objectimpl.cpp"
      [23] log4cxx::helpers::ObjectPtrT<log4cxx::Logger>::~ObjectPtrT(0x2234c, 0x21,0x98208, 0xfec56998, 0x10, 0xffff), at 0x11a48
      [24] __static_initialization_and_destruction_0(0x0, 0xffff, 0x97a34, 0xfecf648c, 0x10, 0x10), at 0x117ec
      [25] GLOBAL_D_main(0x0, 0x0, 0x0, 0xff, 0x0, 0x11824), at 0x11834
      [26] __do_global_dtors_aux(0xfecf42c0, 0x0, 0x0, 0x0, 0x0, 0xff342000), at 0x110a4
      [27] _fini(0x1, 0x1084, 0xfebc1840, 0x0, 0xff342000, 0x1000), at 0x118c8
      [28] _exithandle(0xfecf4540, 0xfebc16c0, 0xfecf3580, 0x34d38, 0x4, 0xffbffbb8), at 0xfec418dc
      [29] exit(0x0, 0xffbffc5c, 0xffbffc64, 0x2238c, 0xfebc16c0, 0xfebc1700), at 0xfec301f0
      (dbx)
      ==================================================================

      Attachments

        Issue Links

          Activity

            People

              carnold@apache.org Curt Arnold
              unniudinoor unnikrishnan udinoor
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: