lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

I've implemented some html-parsing with lpeg and run into some memory problems (segfaults and corrupted memory).

Not sure where in the problem lies, and would appreciate any help in debugging this.

I've not been able to reproduce my problems reliably, to be able to narrow it down into a confided test-case.

My setup is:
CentOS 2.6.9-42.0.3.EL #1 Fri Oct 6 05:59:54 CDT 2006 i686 athlon i386 GNU/Linux

compiler:
gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-3)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Lua bits:
Lua-5.1
LuaCoco-1.1.0
LuaSocket-2.0.1 (with a few patches in the lua sources)
Lua-iconv-r2
LuaZlib-1.0.0
lpeg-0.4

Libs used by the app:
        libmysqlpp.so => /usr/lib/libmysqlpp.so (0x00e96000)
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0x005df000)
        libdl.so.2 => /lib/libdl.so.2 (0x00b40000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x008ba000)
        libm.so.6 => /lib/tls/libm.so.6 (0x005a2000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00111000)
        libc.so.6 => /lib/tls/libc.so.6 (0x00475000)
        libmysqlclient.so.15 => /usr/lib/libmysqlclient.so.15 (0x00119000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00cbb000)
        /lib/ld-linux.so.2 (0x0045c000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x005f3000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x00633000)


Error msg and and backtrace from gdb:

*** glibc detected *** malloc(): memory corruption: 0x097e6390 ***

Program received signal SIGABRT, Aborted.
[Switching to Thread -1219089488 (LWP 14623)]
0x0045c7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
(gdb) bt
#0  0x0045c7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1  0x001407a5 in raise () from /lib/tls/libc.so.6
#2  0x00142209 in abort () from /lib/tls/libc.so.6
#3  0x0017471a in __libc_message () from /lib/tls/libc.so.6
#4  0x0017b99c in _int_malloc () from /lib/tls/libc.so.6
#5  0x0017d401 in malloc () from /lib/tls/libc.so.6
#6  0x0017dbb9 in realloc () from /lib/tls/libc.so.6
#7  0x08177a73 in luaM_realloc_ ()
#8  0x0817b270 in luaH_new ()
#9  0x0817393f in lua_createtable ()
#10 0x00cdd8a9 in pushcapture (cs=0x9997090) at lpeg.c:1291
#11 0x00cdd9ee in getcaptures (L=0x983e130,
s=0x98f8750 "<html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\"><title>free online hold em poker - Google-sökning</title><style><!--\ndiv,td{color:#000}\n.f{color:#6f6f6f}\n.flc,.fl:link{"..., r=0x98fd68f "") at lpeg.c:1317
#12 0x00cddd16 in matchl (L=0x983e130) at lpeg.c:1368
#13 0x08175aba in luaD_precall ()
#14 0x0817db56 in luaV_execute ()
#15 0x081753b0 in luaD_rawrunprotected ()
#16 0x0817e34e in coco_main ()
#17 0xdeadc0c0 in ?? ()
(gdb)


The application was running fine until i added the lpeg stuff.
I'm not sure what I should look at next.. hence my plead for help :)

Anything information-wise I've missed to provide?


--
Med vänlig hälsning, (Best regards)
Andreas Stenius
_________________________________
Boxcom AB

E-post: andreas@boxcom.se
Tel: 08-550 330 50
Fax: 08-550 330 52
Mobil: 070-442 22 50
Web: www.boxcom.se

Virkesvägen 10, 152 42 Södertälje

Automatiska körjournaler - IT-Tjänster
Med en dosa i bilen får du koll på milen!

begin:vcard
fn:Andreas Stenius
n:Stenius;Andreas
org:Boxcom AB
adr;quoted-printable;quoted-printable:;;Virkesv=C3=A4gen 10;S=C3=B6dert=C3=A4lje;;15242;Sweden
email;internet:andreas@boxcom.se
tel;work:08-550 330 50
tel;fax:08-550 330 52
tel;cell:070-44 22 250
url:http://www.boxcom.se
version:2.1
end:vcard