apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thang Nguyen <thangk...@yahoo.co.jp>
Subject *** glibc detected *** .double free or corruption
Date Wed, 08 Nov 2006 04:48:13 GMT
Im having a problem in my app. Im wondering that it is due to a
confliction between apr and glibc. If not, the fault is mine.

My app is using multi-threading fastcgi, mysqlpp for db. I used pthread
for creating threads before, but apr_thread has a nice resource list, so
i changed to apr_thread. Im using apr_reslist for creating (mysqlpp)
connection pool in my app. 

The "double free or corruption" problem occurred just after my app has
finished. In the whole app, it has no problem at all. If i didnt use
create_pool() to create a (apr_hash of) apr_reslist, the problem
disappeared. So, i guess the problem is due to the process of freeing
the apr_reslist_t(s) or terminating the (apr) app.

Thanks in advance

Thang

-------------------------------------------------------
Here is my code for creating pool:
(this function used before creating any threads, just in the inilization
of my app)

=====================
void ConnPool::create_pool()
{
    apr_hash_index_t *hi;
    ThConnConfig *cf;
    apr_status_t rv;
	
    Mutex::Lock lock(_mutex);
	
    if (!_initilized || _pool_created)
		return;
	
    for (hi = apr_hash_first(this->pool, _connHash); hi; 
					hi = apr_hash_next(hi))
    {
        apr_hash_this(hi, NULL, NULL, (void**)&cf);
        
        // create connection pool with this id
        rv = apr_reslist_create(&cf->reslist,
			cf->min, cf->smax, cf->hmax,
			(cf->ttl), 
			&thconn_construct, &thconn_destruct,
			(void*) cf, cf->pool);
				
        if (rv == APR_SUCCESS) {
            apr_pool_cleanup_register(cf->pool, (void*)cf->reslist,
                (apr_status_t (*)(void*))apr_reslist_destroy,
                                  apr_pool_cleanup_null);
        }
        else {
            throw Error("Could not create connection pool for %s",
cf->dsn.id);
        }
		
        log->warn("Created a new connection pool with id [%s]"
			" successfully", cf->dsn.id);
	
    }
	
    log->info("[ConnPool] Created connection pool successfully");
    _pool_created = 1;
}

-------------------------------------------------------
*** glibc detected *** ./webapp.fcgi: double free or corruption (!prev):
0x09e74df8 ***
======= Backtrace: =========
/lib/libc.so.6[0x7f9a68]
/lib/libc.so.6(__libc_free+0x78)[0x7fcf6f]
/usr/lib/libapr-1.so.0(apr_allocator_destroy+0x2d)[0xeb80ad]
/usr/lib/libapr-1.so.0(apr_pool_destroy+0x195)[0xeb87d5]
/usr/lib/libapr-1.so.0(apr_pool_terminate+0x3e)[0xeb89fe]
/usr/lib/libapr-1.so.0(apr_terminate+0x2a)[0xeba63a]
./webapp.fcgi[0x8054eea]
/lib/libc.so.6(__libc_start_main+0xdc)[0x7ab4e4]
./webapp.fcgi(__gxx_personality_v0+0xa1)[0x804d801]
======= Memory map: ========
00110000-00112000 r-xp 00000000 16:42 4734678    /lib/libuuid.so.1.2
00112000-00113000 rwxp 00002000 16:42 4734678    /lib/libuuid.so.1.2
00113000-00117000 r-xp 00000000 16:42 3358866    /usr/lib/libfcgi
++.so.0.0.0
00117000-00118000 rwxp 00003000 16:42 3358866    /usr/lib/libfcgi
++.so.0.0.0
00118000-0012a000 r-xp 00000000 16:42 3358028    /usr/lib/libz.so.1.2.3
0012a000-0012b000 rwxp 00011000 16:42 3358028    /usr/lib/libz.so.1.2.3
0012b000-0012d000 r-xp 00000000 16:42 4734662    /lib/libcom_err.so.2.1
0012d000-0012e000 rwxp 00001000 16:42 4734662    /lib/libcom_err.so.2.1
0012e000-00147000 r-xp 00000000 16:42 4732816    /lib/ld-2.4.so
00147000-00148000 r-xp 00018000 16:42 4732816    /lib/ld-2.4.so
00148000-00149000 rwxp 00019000 16:42 4732816    /lib/ld-2.4.so
00149000-00191000 r-xp 00000000 16:42
1044486    /usr/lib/libglibmm-2.4.so.1.0.23
00191000-00193000 rwxp 00047000 16:42
1044486    /usr/lib/libglibmm-2.4.so.1.0.23
00193000-001cc000 r-xp 00000000 16:42
3358146    /usr/lib/libldap-2.3.so.0.2.7
001cc000-001cd000 rwxp 00039000 16:42
3358146    /usr/lib/libldap-2.3.so.0.2.7
001cd000-001d0000 r-xp 00000000 16:42
3332911    /usr/lib/libgmodule-2.0.so.0.1000.3
001d0000-001d1000 rwxp 00002000 16:42
3332911    /usr/lib/libgmodule-2.0.so.0.1000.3
001d1000-001d4000 r-xp 00000000 16:42
3338745    /usr/lib/libkrb5support.so.0.0
001d4000-001d5000 rwxp 00002000 16:42
3338745    /usr/lib/libkrb5support.so.0.0
001d6000-001f2000 r-xp 00000000 16:42
3818883    /usr/lib/libaprutil-1.so.0.2.2
001f2000-001f3000 rwxp 0001c000 16:42
3818883    /usr/lib/libaprutil-1.so.0.2.2
001f3000-00212000 r-xp 00000000 16:42 4734657    /lib/libexpat.so.0.5.0
00212000-00214000 rwxp 0001e000 16:42 4734657    /lib/libexpat.so.0.5.0
00214000-00226000 r-xp 00000000 16:42 4732870    /lib/libnsl-2.4.so
00226000-00227000 r-xp 00011000 16:42 4732870    /lib/libnsl-2.4.so
00227000-00228000 rwxp 00012000 16:42 4732870    /lib/libnsl-2.4.so
00228000-0022a000 rwxp 00228000 00:00 0
0022a000-00247000 r-xp 00000000 16:45
282456     /home/thang/www/thangapp/src/libthang.so
00247000-00248000 rwxp 0001c000 16:45
282456     /home/thang/www/thangapp/src/libthang.so
00248000-002a4000 r-xp 00000000 16:42
3358073    /usr/lib/libsqlite3.so.0.8.6
002a4000-002a6000 rwxp 0005b000 16:42
3358073    /usr/lib/libsqlite3.so.0.8.6
002a6000-002e4000 r-xp 00000000 16:42
3332913    /usr/lib/libgobject-2.0.so.0.1000.3
002e4000-002e5000 rwxp 0003e000 16:42
3332913    /usr/lib/libgobject-2.0.so.0.1000.3
002e5000-00308000 r-xp 00000000 16:42 4732867    /lib/libm-2.4.so
00308000-00309000 r-xp 00022000 16:42 4732867    /lib/libm-2.4.so
00309000-0030a000 rwxp 00023000 16:42 4732867    /lib/libm-2.4.so
0030a000-00321000 r-xp 00000000 16:42
3352444    /usr/lib/libsasl2.so.2.0.21
00321000-00322000 rwxp 00016000 16:42
3352444    /usr/lib/libsasl2.so.2.0.21
00322000-00363000 r-xp 00000000 16:42 4732848    /lib/libssl.so.0.9.8a
00363000-00367000 rwxp 00040000 16:42 4732848    /lib/libssl.so.0.9.8a
00367000-0038b000 r-xp 00000000 16:42
3338733    /usr/lib/libk5crypto.so.3.0
0038b000-0038c000 rwxp 00024000 16:42
3338733    /usr/lib/libk5crypto.so.3.0
0038c000-0038e000 r-xp 00000000 16:42 4732865    /lib/libdl-2.4.so
0038e000-0038f000 r-xp 00001000 16:42 4732865    /lib/libdl-2.4.so
0038f000-00390000 rwxp 00002000 16:42 4732865    /lib/libdl-2.4.so
00390000-0039b000 r-xp 00000000 16:45
359168     /home/thang/www/thangapp/src/search/webapp/news_search.so
0039b000-0039c000 rwxp 0000a000 16:45
359168     /home/thang/www/thangapp/src/search/webapp/news_search.so
0039c000-003b4000 r-xp 00000000 16:45
345612     /home/thang/www/thangapp/src/webapp/news/modules/news.so
003b4000-003b5000 rwxp 00017000 16:45
345612     /home/thang/www/thangapp/src/webapp/news/modules/news.so
003cd000-003e5000 r-xp 00000000 16:42
3338729    /usr/lib/libgssapi_krb5.so.2.2
003e5000-003e6000 rwxp 00017000 16:42
3338729    /usr/lib/libgssapi_krb5.so.2.2
00438000-0043d000 r-xp 00000000 16:42 4732827    /lib/libcrypt-2.4.so
0043d000-0043e000 r-xp 00004000 16:42 4732827    /lib/libcrypt-2.4.so
0043e000-0043f000 rwxp 00005000 16:42 4732827    /lib/libcrypt-2.4.so
0043f000-00466000 rwxp 0043f000 00:00 0
00466000-0046c000 r-xp 00000000 16:42
3356636    /usr/lib/libgdbm.so.2.0.0
0046c000-0046d000 rwxp 00005000 16:42
3356636    /usr/lib/libgdbm.so.2.0.0
00492000-0049f000 r-xp 00000000 16:42
3355840    /usr/lib/liblber-2.3.so.0.2.7
0049f000-004a0000 rwxp 0000c000 16:42
3355840    /usr/lib/liblber-2.3.so.0.2.7
004ca000-004ef000 r-xp 00000000 16:42
3330098    /usr/lib/libctemplate.so.0
004ef000-004f0000 rwxp 00024000 16:42
3330098    /usr/lib/libctemplate.so.0
004fc000-00501000 r-xp 00000000 16:42
2056365    /usr/lib/libsigc-2.0.so.0.0.0
00501000-00502000 rwxp 00004000 16:42
2056365    /usr/lib/libsigc-2.0.so.0.0.0
0050a000-0059b000 r-xp 00000000 16:42
3329287    /usr/lib/libglib-2.0.so.0.1000.3
0059b000-0059c000 rwxp 00091000 16:42
3329287    /usr/lib/libglib-2.0.so.0.1000.3
0059c000-0067c000 r-xp 00000000 16:42 3333105    /usr/lib/libstdc
++.so.6.0.8
0067c000-0067f000 r-xp 000df000 16:42 3333105    /usr/lib/libstdc
++.so.6.0.8
0067f000-00681000 rwxp 000e2000 16:42 3333105    /usr/lib/libstdc
++.so.6.0.8
00681000-00687000 rwxp 00681000 00:00 0
00687000-006fa000 r-xp 00000000 16:42 3338743    /usr/lib/libkrb5.so.3.2
006fa000-006fc000 rwxp 00073000 16:42 3338743    /usr/lib/libkrb5.so.3.2
00724000-0072c000 r-xp 00000000 16:42
3358862    /usr/lib/libfcgi.so.0.0.0
0072c000-0072d000 rwxp 00008000 16:42
3358862    /usr/lib/libfcgi.so.0.0.0
00795000-00796000 r-xp 00795000 00:00 0          [vdso]
00796000-008c3000 r-xp 00000000 16:42 4732823    /lib/libc-2.4.so
008c3000-008c5000 r-xp 0012d000 16:42 4732823    /lib/libc-2.4.so
008c5000-008c6000 rwxp 0012f000 16:42 4732823    /lib/libc-2.4.so
008c6000-008c9000 rwxp 008c6000 00:00 0
0094c000-00957000 r-xp 00000000 16:42
4732960    /lib/libgcc_s-4.1.1-20060525.so.1
00957000-00958000 rwxp 0000a000 16:42
4732960    /lib/libgcc_s-4.1.1-20060525.so.1
00962000-00994000 r-xp 00000000 16:42
3341111    /usr/lib/liblog4cpp.so.4.0.5
00994000-00996000 rwxp 00031000 16:42
3341111    /usr/lib/liblog4cpp.so.4.0.5
00996000-00ab5000 r-xp 00000000 16:42
3822318    /usr/lib/mysql/libmysqlclient.so.15.0.0
00ab5000-00af7000 rwxp 0011e000 16:42
3822318    /usr/lib/mysql/libmysqlclient.so.15.0.0
00af7000-00af8000 rwxp 00af7000 00:00 0
00bae000-00be7000 r-xp 00000000 16:42 3333781    /usr/lib/libmysqlpp.so
00be7000-00be9000 rwxp 00038000 16:42 3333781    /usr/lib/libmysqlpp.so
00bea000-00d0a000 r-xp 00000000 16:42
3822320    /usr/lib/mysql/libmysqlclient_r.so.15.0.0
00d0a000-00d4c000 rwxp 00120000 16:42
3822320    /usr/lib/mysql/libmysqlclient_r.so.15.0.0
00d4c000-00d4d000 rwxp 00d4c000 00:00 0
00dbe000-00dc7000 r-xp 00000000 16:42
4732874    /lib/libnss_files-2.4.so
00dc7000-00dc8000 r-xp 00008000 16:42
4732874    /lib/libnss_files-2.4.so
00dc8000-00dc9000 rwxp 00009000 16:42
4732874    /lib/libnss_files-2.4.so
00deb000-00e11000 r-xp 00000000 16:42
2056402    /usr/lib/libcgicc.so.5.0.1
00e11000-00e12000 rwxp 00025000 16:42
2056402    /usr/lib/libcgicc.so.5.0.1
00e54000-00e63000 r-xp 00000000 16:42 4732942    /lib/libresolv-2.4.so
00e63000-00e64000 r-xp 0000e000 16:42 4732942    /lib/libresolv-2.4.so
00e64000-00e65000 rwxp 0000f000 16:42 4732942    /lib/libresolv-2.4.so
00e65000-00e67000 rwxp 00e65000 00:00 0
00ea4000-00ecb000 r-xp 00000000 16:42
3340805    /usr/lib/libapr-1.so.0.2.2
00ecb000-00ecc000 rwxp 00027000 16:42
3340805    /usr/lib/libapr-1.so.0.2.2
00f0c000-00f1c000 r-xp 00000000 16:42 4732847    /lib/libpthread-2.4.so
00f1c000-00f1d000 r-xp 0000f000 16:42 4732847    /lib/libpthread-2.4.so
00f1d000-00f1e000 rwxp 00010000 16:42 4732847    /lib/libpthread-2.4.so
00f1e000-00f20000 rwxp 00f1e000 00:00 0
00fb0000-00fc9000 r-xp 00000000 16:45
282459     /home/thang/www/thangapp/src/webapp/libthang_webapp.so
00fc9000-00fca000 rwxp 00019000 16:45
282459     /home/thang/www/thangapp/src/webapp/libthang_webapp.so
00fca000-010e9000 r-xp 00000000 16:42
4732840    /lib/libcrypto.so.0.9.8a
010e9000-010fc000 rwxp 0011e000 16:42
4732840    /lib/libcrypto.so.0.9.8a
010fc000-010ff000 rwxp 010fc000 00:00 0
045d1000-04742000 r-xp 00000000 16:42
3343144    /usr/lib/libxapian.so.11.1.0
04742000-04750000 rwxp 00171000 16:42
3343144    /usr/lib/libxapian.so.11.1.0
05840000-05964000 r-xp 00000000 16:42
3358057    /usr/lib/libxml2.so.2.6.23
05964000-0596c000 rwxp 00124000 16:42
3358057    /usr/lib/libxml2.so.2.6.23
0596c000-0596d000 rwxp 0596c000 00:00 0
08048000-08058000 r-xp 00000000 16:45
345709     /home/thang/www/thangapp/src/webapp/news/webapp.fcgi
08058000-08059000 rw-p 00010000 16:45
345709     /home/thang/www/thangapp/src/webapp/news/webapp.fcgi
09e5b000-09f40000 rw-p 09e5b000 00:00 0
795a5000-795a6000 ---p 795a5000 00:00 0
795a6000-79fa6000 rw-p 795a6000 00:00 0
79fa6000-79fa7000 ---p 79fa6000 00:00 0
79fa7000-7a9a7000 rw-p 79fa7000 00:00 0
7a9a7000-7a9a8000 ---p 7a9a7000 00:00 0
7a9a8000-7b3a8000 rw-p 7a9a8000 00:00 0
b2400000-b2452000 rw-p b2400000 00:00 0
b2452000-b2500000 ---p b2452000 00:00 0
b7fd7000-b7fe1000 rw-p b7fd7000 00:00 0
b7ffd000-b7fff000 rw-p b7ffd000 00:00 0
bf950000-bf966000 rw-p bf950000 00:00 0          [stack]



--------------------------------------
Protect Your PC Now ! -- 0 Yen Security Campaign
http://pr.mail.yahoo.co.jp/security/


Mime
View raw message