Strange bug on linux ubuntu 10.04 server

Linux specific forum
Motu
Enthusiast
Enthusiast
Posts: 160
Joined: Tue Oct 19, 2004 12:24 pm

Strange bug on linux ubuntu 10.04 server

Post by Motu »

I have a very strange problem with a linux application that is running on a server. It was running well for about a week now - but today I got a very strange crash. the application was compiled with -t and -d option (as it uses threads). Here is what came out as debug message:

*** glibc detected *** ./xxx.bin: double free or corruption (fasttop): 0x10d53398 ***
======= Backtrace: =========
/lib32/libc.so.6(+0x6c231)[0xf7658231]
/lib32/libc.so.6(+0x6dab8)[0xf7659ab8]
/lib32/libc.so.6(cfree+0x6d)[0xf765cb9d]
./xxx.bin[0x8105f80]
./xxx.bin[0x809f7f3]
======= Memory map: ========
08048000-08113000 r-xp 00000000 09:02 22706517 /xxx/xxx/xxx/xxx/xxx.bin
08113000-08114000 r-xp 000ca000 09:02 22706517 /xxx/xxx/xxx/xxx/xxx.bin
08114000-08132000 rwxp 000cb000 09:02 22706517 /xxx/xxx/xxx/xxx/xxx.bin
08132000-08148000 rwxp 00000000 00:00 0
09b3f000-15577000 rwxp 00000000 00:00 0 [heap]
c2c62000-da6eb000 rwxp 00000000 00:00 0
ec84b000-ec855000 r-xp 00000000 09:02 40519662 /lib32/libnss_files-2.11.1.so
ec855000-ec856000 r-xp 00009000 09:02 40519662 /lib32/libnss_files-2.11.1.so
ec856000-ec857000 rwxp 0000a000 09:02 40519662 /lib32/libnss_files-2.11.1.so
ec865000-ec8a4000 rwxp 00000000 00:00 0
ec8a4000-ec8a5000 ---p 00000000 00:00 0
ec8a5000-f1d86000 rwxp 00000000 00:00 0
f1f00000-f1f21000 rwxp 00000000 00:00 0
f1f21000-f2000000 ---p 00000000 00:00 0
f20c3000-f20c4000 rwxp 00000000 00:00 0
f2143000-f2153000 r-xp 00000000 09:02 40519668 /lib32/libresolv-2.11.1.so
f2153000-f2154000 r-xp 00010000 09:02 40519668 /lib32/libresolv-2.11.1.so
f2154000-f2155000 rwxp 00011000 09:02 40519668 /lib32/libresolv-2.11.1.so
f2155000-f2158000 rwxp 00000000 00:00 0
f2891000-f28ae000 r-xp 00000000 09:02 8273356 /usr/lib32/libgcc_s.so.1
f28ae000-f28af000 r-xp 0001c000 09:02 8273356 /usr/lib32/libgcc_s.so.1
f28af000-f28b0000 rwxp 0001d000 09:02 8273356 /usr/lib32/libgcc_s.so.1
f28be000-f75ec000 rwxp 00000000 00:00 0
f75ec000-f773f000 r-xp 00000000 09:02 40519653 /lib32/libc-2.11.1.so
f773f000-f7740000 ---p 00153000 09:02 40519653 /lib32/libc-2.11.1.so
f7740000-f7742000 r-xp 00153000 09:02 40519653 /lib32/libc-2.11.1.so
f7742000-f7743000 rwxp 00155000 09:02 40519653 /lib32/libc-2.11.1.so
f7743000-f7747000 rwxp 00000000 00:00 0
f7747000-f775c000 r-xp 00000000 09:02 40519667 /lib32/libpthread-2.11.1.so
f775c000-f775d000 r-xp 00014000 09:02 40519667 /lib32/libpthread-2.11.1.so
f775d000-f775e000 rwxp 00015000 09:02 40519667 /lib32/libpthread-2.11.1.so
f775e000-f7760000 rwxp 00000000 00:00 0
f7760000-f7784000 r-xp 00000000 09:02 40519657 /lib32/libm-2.11.1.so
f7784000-f7785000 r-xp 00023000 09:02 40519657 /lib32/libm-2.11.1.so
f7785000-f7786000 rwxp 00024000 09:02 40519657 /lib32/libm-2.11.1.so
f778d000-f778e000 rwxp 00000000 00:00 0
f778e000-f7792000 r-xp 00000000 09:02 40519661 /lib32/libnss_dns-2.11.1.so
f7792000-f7793000 r-xp 00004000 09:02 40519661 /lib32/libnss_dns-2.11.1.so
f7793000-f7794000 rwxp 00005000 09:02 40519661 /lib32/libnss_dns-2.11.1.so
f7794000-f7796000 rwxp 00000000 00:00 0
f7796000-f7797000 r-xp 00000000 00:00 0 [vdso]
f7797000-f77b3000 r-xp 00000000 09:02 40519650 /lib32/ld-2.11.1.so
f77b3000-f77b4000 r-xp 0001b000 09:02 40519650 /lib32/ld-2.11.1.so
f77b4000-f77b5000 rwxp 0001c000 09:02 40519650 /lib32/ld-2.11.1.so
ffc78000-ffc8d000 rwxp 00000000 00:00 0 [stack]

[Debugger Error] Program aborted. (by external library)
[Debugger Error] File: xxx.pb (Line: 14172)

well - if anyone has any idea what this means or (even better) what I can do about it - please tell :-)
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Strange bug on linux ubuntu 10.04 server

Post by ts-soft »

why is your application not compiled as 64-bit? it seems your server uses 64-bit.

greetings
Thomas
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: Strange bug on linux ubuntu 10.04 server

Post by Trond »

double free or corruption
Either some memory was overwritten, or you called FreeMemory() on a memory block that was already free or was never allocated.
Motu
Enthusiast
Enthusiast
Posts: 160
Joined: Tue Oct 19, 2004 12:24 pm

Re: Strange bug on linux ubuntu 10.04 server

Post by Motu »

Yes, it is a 32bit application. There are some problems with the 64 bit network lib of pb - that's why we use the 32 bit version.

Anyway - the bug occurs in a line where only procedurereturn is written... Does not sound like a freememory bug to me. Is there any way I can find out what exactly causes the problem?
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Strange bug on linux ubuntu 10.04 server

Post by ts-soft »

You can debug with purifier!
Motu
Enthusiast
Enthusiast
Posts: 160
Joined: Tue Oct 19, 2004 12:24 pm

Re: Strange bug on linux ubuntu 10.04 server

Post by Motu »

well, purifier ist not working well when thousands of people use your server at the same time...
GBeebe
Enthusiast
Enthusiast
Posts: 263
Joined: Sat Oct 09, 2004 6:52 pm
Location: Franklin, PA - USA
Contact:

Re: Strange bug on linux ubuntu 10.04 server

Post by GBeebe »

I've gotten errors on ProcedureReturn and EndProcedure (and once, a blank line at the end of the main code) before. The problem is has usually been caused by a library (mostly ones that I've created) that is called in that procedure (or program). I've found that in the case of my libraries, it's a memory error as described in your post, or in other cases it's fixed by using the "C" variants of library calling.
Motu
Enthusiast
Enthusiast
Posts: 160
Joined: Tue Oct 19, 2004 12:24 pm

Re: Strange bug on linux ubuntu 10.04 server

Post by Motu »

Well, the problem is i am only calling function of purebasics own command set (network, string, etc.).
Any other ideas? Could it be a bug inside a lib of purebasic itself?
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: Strange bug on linux ubuntu 10.04 server

Post by Trond »

Since you use threads there's a fair chance this is the result of some race condition where some shared resource is insufficiently protected from concurrent access.
Post Reply