logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marshall Powers" <mpow...@appsecinc.com>
Subject AIX segfault
Date Thu, 28 Jun 2007 18:52:53 GMT
I'm getting a segfault on 64-bit AIX 5.3. I'm using static libraries of
log4cxx, apr, and aprutil. Here is a test program and Makefile I am using
that causes the crash:

 

_main.cpp_

 

#include <log4cxx/logger.h>

#include <log4cxx/basicconfigurator.h>

#include <log4cxx/rolling/rollingfileappender.h>

 

using namespace log4cxx;

using namespace log4cxx::rolling;

 

int main(int argc, char * argv[]) {

    LoggerPtr root = Logger::getRootLogger();

    BasicConfigurator::configure();

    

    RollingFileAppenderPtr rfa;

    if(argc > 1) {

        rfa = new RollingFileAppender();

    }

    

    LOG4CXX_DEBUG(root, "HELLO WORLD!");

 

    return 0;

}

 

 

_Makefile_

 

LOG4CXX=/path_to_log4cxx

INCLUDE=-I$(LOG4CXX)/include

LIBDIR=-L$(LOG4CXX)/lib

LIBS=-llog4cxxd -lapr-1d -laprutil-1d -liconv -pthread

FLAGS=-g -maix64

BIN=testptr

 

$(BIN): main.cpp

            g++ $(FLAGS) $(INCLUDE) $(LIBDIR) $(LIBS) main.cpp -o $(BIN)

            

clean:

            rm -f core $(BIN)

            

run:

            ./$(BIN)

 

all: main.cpp

 

 

Basically, it does some very basic logging. If you give no command-line
args, the program runs just fine, no trouble. If you pass any arguments, it
will instantiate a RollingFileAppender before doing the logging. However, if
you do create that object, you get a segfault. GDB shows this:

 

(gdb) set args 1

(gdb) run

Starting program: /home/mpowers/log4cxx_smart/testptr 1

 

Program received signal SIGSEGV, Segmentation fault.

[Switching to Thread 1]

0x09000000000523ec in malloc_y () from /usr/lib/libc.a(shr_64.o)

(gdb) bt

#0  0x09000000000523ec in malloc_y () from /usr/lib/libc.a(shr_64.o)

#1  0x090000000004f478 in malloc_common_52_36 () from
/usr/lib/libc.a(shr_64.o)

#2  0x09000000003d499c in iconv_open (t_name=0x1002a3808 "UTF-8",
f_name=0x9001000a0001108 "ISO8859-1")

    at ../../../../../../../src/bos/usr/ccs/lib/libiconv/iconv.c:431

#3  0x000000010005386c in apr_xlate_open (convset=0x1100cec58,
topage=0x1002a3808 "UTF-8", frompage=0x9001000a0001108 "ISO8859-1",
pool=0x1100cec98)

    at /home.local/mpowers/new_log4cxx/lib/apr-util-1.2.7/xlate/xlate.c:251

#4  0x000000010004f93c in
log4cxx::helpers::APRCharsetDecoder::APRCharsetDecoder(char const*)
(this=0x1100cec30, frompage=0x1 "")

    at /home.local/mpowers/new_log4cxx/src/charsetdecoder.cpp:64

#5  0x0000000100050168 in
log4cxx::helpers::CharsetDecoder::createDefaultDecoder() () at
/home.local/mpowers/new_log4cxx/src/charsetdecoder.cpp:460

#6  0x0000000100050260 in
log4cxx::helpers::CharsetDecoder::getDefaultDecoder() () at
/home.local/mpowers/new_log4cxx/src/charsetdecoder.cpp:467

#7  0x000000010004d150 in log4cxx::helpers::Transcoder::decode(char const*,
unsigned long, std::string&) (src=0x1100ccbe8 "HELLO WORLD!", len=12,

    dst=@0xffffffffffff8d8) at
/home.local/mpowers/new_log4cxx/src/transcoder.cpp:57

#8  0x00000001000bf6c4 in void
log4cxx::helpers::Transcoder::decode<std::string>(std::string const&,
std::string&) (src=@0xffffffffffff9c0,

    dst=@0xffffffffffff8d8) at
/home.local/mpowers/new_log4cxx/include/log4cxx/helpers/transcoder.h:49

#9  0x00000001000c5ac8 in
log4cxx::Logger::forcedLog(log4cxx::helpers::ObjectPtrT<log4cxx::Level>
const&, std::string const&, log4cxx::spi::LocationInfo const&)
(this=0x1100c4a70, level1=@0x1100aa1c0, message=@0xffffffffffff9c0,
location=@0xffffffffffff9a0) at
/home.local/mpowers/new_log4cxx/src/logger.cpp:109

#10 0x0000000100000ad8 in main (argc=2, argv=0xffffffffffffab8) at
main.cpp:17

 

 

 

This crash seems to occur if I instantiate any object and give it to a smart
pointer (*Ptr) variable. It's not limited to RollingFileAppender. Any ideas
for resolving this problem? Can anyone else reproduce this on their own
AIXes? I've tested this code on other OSes such as HPUX, windows, solaris,
and linux without trouble.

 

 

 

Thanks for the help,

Marshall


Mime
View raw message