Hi all,

I am trying to debug some double freeing (apr_pool_destroy) of pools in
my program - that is not multi-threaded but multi-process.

I saw setting APR_POOL_DEBUG can give me lots of good info on stderr.

I built APR 1.7 with:
./configure --prefix=/usr/local --enable-pool-debug=all
make
sudo make install

BTW, 'make test' fails on "APR Lock Performance Test", but it succeeded
before I set APR_POOL_DEBUG. Since it's a performance test, I assume
that when the debugging output is printed, among other things, this
causes enough delay to make the performance test fail.

My question about how to debuging should be done. abort() is called on
apr_initialize():

Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff7d63537 in __GI_abort () at abort.c:79
#2  0x00007ffff7f459ce in apr_pool_check_owner (pool=<optimized out>)
    at memory/unix/apr_pools.c:1636
#3  0x00007ffff7f5939a in apr_pool_check_owner (pool=0x5555555942a0)
    at memory/unix/apr_pools.c:1824
#4  apr_pool_check_integrity (pool=0x5555555942a0) at
memory/unix/apr_pools.c:1645
#5  apr_pcalloc_debug (pool=pool@entry=0x5555555942a0, size=size@entry=48,
    file_line=file_line@entry=0x7ffff7f66abc "locks/unix/thread_mutex.c:50")
    at memory/unix/apr_pools.c:1814
#6  0x00007ffff7f580a7 in apr_thread_mutex_create
(mutex=mutex@entry=0x555555594328,
    flags=flags@entry=1, pool=pool@entry=0x5555555942a0)
    at locks/unix/thread_mutex.c:50
#7  0x00007ffff7f59aa8 in apr_pool_create_ex_debug (
    newpool=newpool@entry=0x7ffff7f73e20 <global_pool>,
parent=parent@entry=0x0,
    abort_fn=abort_fn@entry=0x0, allocator=allocator@entry=0x0,
    file_line=file_line@entry=0x7ffff7f66b71 "memory/unix/apr_pools.c:1676")
    at memory/unix/apr_pools.c:2043
#8  0x00007ffff7f59ee9 in apr_pool_initialize () at
memory/unix/apr_pools.c:1676
#9  0x00007ffff7f5b493 in apr_initialize () at misc/unix/start.c:55
#10 0x000055555557ddba in main (ArgCount=3, Arg=0x7fffffffe018) at
src/inst/main.c:9
(gdb)

Is this expected? How can I debug pools if just calling apr_initialize
causes an abort. It's the first line in main():

If this is unexpected, I'll try to reproduce this with an extremely
simple program. Though, I think I'm probably doing something wrong.

I'm not sure if in older versions of APR there was apr_app_initialize()
and if I should be calling that instead. From the docs, it doesn't look
needed for my program because I am not writing (yet?) a cross-platform
program, but rather using only parts of APR such as pools and buckets.

Is it impossible to use '--enable-pool-debug=all'?

Should I use '--enable-pool-debug=yes' or '--enable-pool-debug=verbose'?

Any hints?

Thanks,

Simon

Reply via email to