*** glibc detected *** double free or corruption (!prev): 0x

Started by newdep, December 28, 2005, 12:34:10 PM

Previous topic - Next topic

newdep

#15
All version of newlisp do crash ....



The error here is realted to: "Crashes in malloc(), free() or realloc() are almost always related to heap corruption, such as overflowing an allocated chunk or freeing the same pointer twice"



But where ? Im not sure if its newlisp related could very well be a new version

of anyting below..



 libm.so.6 => /lib/libm.so.6 (0x4002c000)

 libdl.so.2 => /lib/libdl.so.2 (0x40050000)

 libreadline.so.4 => /usr/lib/libreadline.so.4 (0x40054000)

 libncurses.so.5 => /lib/libncurses.so.5 (0x40080000)

 libc.so.6 => /lib/libc.so.6 (0x400bf000)

 /lib/ld-linux.so.2 (0x40000000)

 libgpm.so.1 => /lib/libgpm.so.1 (0x401d8000)





Its very very odd, I cant reproduce the error to happen it just happens

randomly now... all get-url actions are oke... Could it be a memory free issue?



Norman.
-- (define? (Cornflakes))

newdep

#16
NOTES

       The Unix98 standard requires malloc(), calloc(), and realloc() to set errno to ENOMEM upon failure. Glibc assumes  that

       this  is  done (and the glibc versions of these routines do this); if you use a private malloc implementation that does

       not set errno, then certain library routines may fail without having a reason in errno.



       Crashes in malloc(), free() or realloc() are almost always related to heap corruption, such as overflowing an allocated

       chunk or freeing the same pointer twice.



       Recent  versions  of Linux libc (later than 5.4.23) and GNU libc (2.x) include a malloc implementation which is tunable

       via environment variables.  When MALLOC_CHECK_ is set, a special (less  efficient)  implementation  is  used  which  is

       designed  to be tolerant against simple errors, such as double calls of free() with the same argument, or overruns of a

       single byte (off-by-one bugs).  Not all such errors can be protected against, however, and memory leaks can result.  If

       MALLOC_CHECK_  is  set  to 0, any detected heap corruption is silently ignored; if set to 1, a diagnostic is printed on

       stderr; if set to 2, abort() is called immediately.  This can be useful because  otherwise  a  crash  may  happen  much

       later, and the true cause for the problem is then very hard to track down.



BUGS

       By  default,  Linux  follows  an optimistic memory allocation strategy.  This means that when malloc() returns non-NULL

       there is no guarantee that the memory really is available. This is a really bad bug.  In case it  turns  out  that  the

       system  is  out  of memory, one or more processes will be killed by the infamous OOM killer.  In case Linux is employed

       under circumstances where it would be less desirable to suddenly lose some randomly picked processes, and moreover  the

       kernel version is sufficiently recent, one can switch off this overcommitting behavior using a command like

              # echo 2 > /proc/sys/vm/overcommit_memory

       See also the kernel Documentation directory, files vm/overcommit-accounting and sysctl/vm.txt.









So I put the MALLOC_CHECK_=0/1/2 in my enironment and it runs !

No problems and NO abort!.. So somthing is fishy here.. This should not

be done but be managed by libc  (see above the man page of malloc)



Seeking the internet on this topic it seems to happen a lot... But if its

a slackware distribution issue ?? I cant figure it out..





Norman.
-- (define? (Cornflakes))

newdep

#17
Okay !

some ColdMetal debugging here a gdb output with realtime tracking...

Hope its usefull for a small indication...





$gdb newlisp

GNU gdb 6.3

Copyright 2004 Free Software Foundation, Inc.

GDB is free software, covered by the GNU General Public License, and you are

welcome to change it and/or distribute copies of it under certain conditions.

Type "show copying" to see the conditions.

There is absolutely no warranty for GDB.  Type "show warranty" for details.

This GDB was configured as "i486-slackware-linux"...(no debugging symbols found)

Using host libthread_db library "/lib/libthread_db.so.1".



(gdb) handle SIGPIPE nostop

Signal        Stop      Print   Pass to program Description

SIGPIPE       No        Yes     Yes             Broken pipe

(gdb) run

Starting program: /usr/bin/newlisp

(no debugging symbols found)

(no debugging symbols found)

newLISP v.8.7.6 on linux, execute 'newlisp -h' for more info.



> (load "rss-ticker2.lsp")



--------------

Remove screen output here...

--------------



*** glibc detected *** double free or corruption (!prev): 0x080a2850 ***



Program received signal SIGABRT, Aborted.

0x400e7d81 in kill () from /lib/libc.so.6

(gdb) bt full

#0  0x400e7d81 in kill () from /lib/libc.so.6

No symbol table info available.

#1  0x400e7b05 in raise () from /lib/libc.so.6

No symbol table info available.

#2  0x400e905d in abort () from /lib/libc.so.6

No symbol table info available.

#3  0x4011a46c in __libc_message () from /lib/libc.so.6

No symbol table info available.

#4  0x40122df6 in malloc_printerr () from /lib/libc.so.6

No symbol table info available.

#5  0x40121abf in _int_free () from /lib/libc.so.6

No symbol table info available.

#6  0x401206df in free () from /lib/libc.so.6

No symbol table info available.

#7  0x0804c268 in ?? ()

No symbol table info available.

#8  0x080a2850 in ?? ()

No symbol table info available.

#9  0x401d59c0 in __libc_tsd_MALLOC_data () from /lib/libc.so.6

No symbol table info available.

#10 0xbffff0e8 in ?? ()

No symbol table info available.

#11 0x0809d8c0 in ?? ()

No symbol table info available.

#12 0x080884d8 in ?? ()

No symbol table info available.

#13 0x080a55b0 in ?? ()

No symbol table info available.

#14 0xbffff108 in ?? ()

No symbol table info available.

#15 0x0804b608 in ?? ()

No symbol table info available.

#16 0x080a5590 in ?? ()

No symbol table info available.

#17 0x0809d8a0 in ?? ()

No symbol table info available.

#18 0xbffff108 in ?? ()

No symbol table info available.

#19 0x0804c340 in ?? ()

No symbol table info available.

#20 0x00000024 in ?? ()

No symbol table info available.

#21 0x00000004 in ?? ()

No symbol table info available.

#22 0x08073910 in ?? ()

No symbol table info available.

#23 0x08073900 in ?? ()

No symbol table info available.

---Type <return> to continue, or q <return> to quit---

#24 0x00000003 in ?? ()

No symbol table info available.

#25 0x0809d8a0 in ?? ()

No symbol table info available.

#26 0xbffff128 in ?? ()

No symbol table info available.

#27 0x08050059 in ?? ()

No symbol table info available.

#28 0x08073900 in ?? ()

No symbol table info available.

#29 0x08095748 in ?? ()

No symbol table info available.

#30 0x00000024 in ?? ()

No symbol table info available.

#31 0x080731a0 in ?? ()

No symbol table info available.

#32 0x080a7a38 in ?? ()

No symbol table info available.

#33 0x080735c0 in ?? ()

No symbol table info available.

#34 0xbffff158 in ?? ()

No symbol table info available.

#35 0x080508ce in ?? ()

No symbol table info available.

#36 0x08073640 in ?? ()

No symbol table info available.

#37 0x00000008 in ?? ()

No symbol table info available.

#38 0x40121a24 in _int_free () from /lib/libc.so.6

No symbol table info available.

Previous frame inner to this frame (corrupt stack?)

(gdb)



in short ->



(gdb) backtrace

#0  0x400e7d81 in kill () from /lib/libc.so.6

#1  0x400e7b05 in raise () from /lib/libc.so.6

#2  0x400e905d in abort () from /lib/libc.so.6

#3  0x4011a46c in __libc_message () from /lib/libc.so.6

#4  0x40122df6 in malloc_printerr () from /lib/libc.so.6

#5  0x40121abf in _int_free () from /lib/libc.so.6

#6  0x401206df in free () from /lib/libc.so.6

#7  0x0804c268 in ?? ()

#8  0x080a2850 in ?? ()

#9  0x401d59c0 in __libc_tsd_MALLOC_data () from /lib/libc.so.6

#10 0xbffff0e8 in ?? ()

#11 0x0809d8c0 in ?? ()

#12 0x080884d8 in ?? ()

#13 0x080a55b0 in ?? ()

#14 0xbffff108 in ?? ()

#15 0x0804b608 in ?? ()

#16 0x080a5590 in ?? ()

#17 0x0809d8a0 in ?? ()

#18 0xbffff108 in ?? ()

#19 0x0804c340 in ?? ()

#20 0x00000024 in ?? ()

#21 0x00000004 in ?? ()

#22 0x08073910 in ?? ()

#23 0x08073900 in ?? ()

#24 0x00000003 in ?? ()

#25 0x0809d8a0 in ?? ()

#26 0xbffff128 in ?? ()

#27 0x08050059 in ?? ()

#28 0x08073900 in ?? ()

#29 0x08095748 in ?? ()

#30 0x00000024 in ?? ()

#31 0x080731a0 in ?? ()

#32 0x080a7a38 in ?? ()

#33 0x080735c0 in ?? ()

#34 0xbffff158 in ?? ()

#35 0x080508ce in ?? ()

#36 0x08073640 in ?? ()

#37 0x00000008 in ?? ()

#38 0x40121a24 in _int_free () from /lib/libc.so.6
-- (define? (Cornflakes))

newdep

#18
Sorry ! no debug info in previous one !! here is the correct debug...

enjoy ;-)





*** glibc detected *** double free or corruption (!prev): 0x080a2848 ***



Program received signal SIGABRT, Aborted.

0x400e7d81 in kill () from /lib/libc.so.6

(gdb) bt full

#0  0x400e7d81 in kill () from /lib/libc.so.6

No symbol table info available.

#1  0x400e7b05 in raise () from /lib/libc.so.6

No symbol table info available.

#2  0x400e905d in abort () from /lib/libc.so.6

No symbol table info available.

#3  0x4011a46c in __libc_message () from /lib/libc.so.6

No symbol table info available.

#4  0x40122df6 in malloc_printerr () from /lib/libc.so.6

No symbol table info available.

#5  0x40121abf in _int_free () from /lib/libc.so.6

No symbol table info available.

#6  0x401206df in free () from /lib/libc.so.6

No symbol table info available.

#7  0x0804c268 in deleteList (cell=0x401d3ff4) at newlisp.c:1536

        next = (CELL *) 0x401d3ff4

#8  0x0804b608 in evaluateExpression (cell=0x80a2848) at newlisp.c:1112

        result = (CELL *) 0x80a55a8

        args = (CELL *) 0x8073910

        pCell = (CELL *) 0x401d59c0

        resultIdxSave = 4

#9  0x08050059 in evaluateBlock (cell=0x8073900) at newlisp.c:3966

        result = (CELL *) 0x0

#10 0x080508ce in p_dolist (params=0x8073290) at newlisp.c:4246

        cell = (CELL *) 0x3

        list = (CELL *) 0x80735c0

        symbol = (SYMBOL *) 0x80930e8

#11 0x0804b832 in evaluateExpression (cell=0x80731a0) at newlisp.c:1058

        result = (CELL *) 0x80731a0

        args = (CELL *) 0x8073470

        pCell = (CELL *) 0x8071e00

        resultIdxSave = 2

#12 0x08050059 in evaluateBlock (cell=0x80731a0) at newlisp.c:3966

        result = (CELL *) 0x0

#13 0x080503c5 in repeat (params=0x8073150, type=2) at newlisp.c:4094

        result = (CELL *) 0x2

        cell = (CELL *) 0x0

        resultIdxSave = 2

#14 0x080502d1 in p_until (params=0x8073150) at newlisp.c:4060

No locals.

#15 0x0804b832 in evaluateExpression (cell=0x8073140) at newlisp.c:1058

        result = (CELL *) 0x1

        args = (CELL *) 0x8073160

        pCell = (CELL *) 0x8071d90

        resultIdxSave = 2

#16 0x0804b07c in evaluateStream (stream=0xbffff320, outDevice=0, flag=1) at newlisp.c:855

        program = (CELL *) 0x8073000

        eval = (CELL *) 0x80731e0

---Type <return> to continue, or q <return> to quit---

        resultIdxSave = 1

        result = 1

#17 0x0804d8ac in loadFile (fileName=0x8091fc8 "rss-ticker2.lsp", offset=0, encryptFlag=134683484) at newlisp.c:2446

        result = (CELL *) 0x0

        stream = {handle = 6, ptr = 0x80998d7 "nn(println default)n(exit)n",

  buffer = 0x8099098 "#!/usr/bin/newlispn;;n;; RSS Ticker v1.0 (c) Norman 2004n;;n;; Displays RSS Feed titels in your terminal screenn;; by using tput codes.n;;n;; Linux terminal version with ANSI and tput requiredn;; n;;n"..., position = 0, size = 18432}

        errNo = 0

        dataLen = 0

        errorJumpSave = {{__jmpbuf = {134709576, -1073744412, -1073744780, -1073744488, -1073744832, 134522561}, __mask_was_saved = 0,

    __saved_mask = {__val = {0 <repeats 32 times>}}}}

        key = "0000000001000000@H35@010000"

#18 0x08050bc1 in p_load (params=0x8071d40) at newlisp.c:4366

        fileName = 0x8091fc8 "rss-ticker2.lsp"

        result = (CELL *) 0x0

#19 0x0804b832 in evaluateExpression (cell=0x8072fb0) at newlisp.c:1058

        result = (CELL *) 0x1

        args = (CELL *) 0x8072fc0

        pCell = (CELL *) 0x8072920

        resultIdxSave = 1

#20 0x0804b07c in evaluateStream (stream=0xbffff400, outDevice=2, flag=0) at newlisp.c:855

        program = (CELL *) 0x8071d60

        eval = (CELL *) 0x8071d40

        resultIdxSave = 0

        result = 1

#21 0x0804aeca in executeCommandLine (command=0xbffff400 "", outDevice=2, cmdStream=0xbffff460) at newlisp.c:833

        stream = {handle = 0, ptr = 0x8092088 "", buffer = 0x8092070 "(load "rss-ticker2.lsp")", position = 0, size = 2072}

#22 0x0804a801 in main (argc=1, argv=0xbffff5e4) at newlisp.c:663

        command = "c22304b224Wf@¨÷04@ ", '' <repeats 11 times>, ":þf@d«f@t#f@¨÷04@b000000214ý04@Ðý04@Ø_01@|f01@00000000dõÿ¿230u00@Ý22204b216ÿw01À21204b õÿ¿(f01@05000000Ðý04@010000000000000001000000211Ëf@ õÿ¿ô?35@00000000äõÿ¿8õÿ¿216ÿw01220õÿ¿Ðd01@Ý22204b/÷ÿ¿Îð21@¤235f@¨÷04@8õÿ¿uBr@ô?35@ìõÿ¿Xõÿ¿ºn04@Ø_01@Xk01@X"...

        cmdStream = {handle = 0, ptr = 0x0, buffer = 0x0, position = 0, size = 0}

        idx = 1

        cmd = 0x8092070 "(load "rss-ticker2.lsp")"

(gdb) backtrace

#0  0x400e7d81 in kill () from /lib/libc.so.6

#1  0x400e7b05 in raise () from /lib/libc.so.6

#2  0x400e905d in abort () from /lib/libc.so.6

#3  0x4011a46c in __libc_message () from /lib/libc.so.6

#4  0x40122df6 in malloc_printerr () from /lib/libc.so.6

#5  0x40121abf in _int_free () from /lib/libc.so.6

#6  0x401206df in free () from /lib/libc.so.6

#7  0x0804c268 in deleteList (cell=0x401d3ff4) at newlisp.c:1536

#8  0x0804b608 in evaluateExpression (cell=0x80a2848) at newlisp.c:1112

#9  0x08050059 in evaluateBlock (cell=0x8073900) at newlisp.c:3966

#10 0x080508ce in p_dolist (params=0x8073290) at newlisp.c:4246

#11 0x0804b832 in evaluateExpression (cell=0x80731a0) at newlisp.c:1058

#12 0x08050059 in evaluateBlock (cell=0x80731a0) at newlisp.c:3966

#13 0x080503c5 in repeat (params=0x8073150, type=2) at newlisp.c:4094

#14 0x080502d1 in p_until (params=0x8073150) at newlisp.c:4060

#15 0x0804b832 in evaluateExpression (cell=0x8073140) at newlisp.c:1058

#16 0x0804b07c in evaluateStream (stream=0xbffff320, outDevice=0, flag=1) at newlisp.c:855

#17 0x0804d8ac in loadFile (fileName=0x8091fc8 "rss-ticker2.lsp", offset=0, encryptFlag=134683484) at newlisp.c:2446

#18 0x08050bc1 in p_load (params=0x8071d40) at newlisp.c:4366

#19 0x0804b832 in evaluateExpression (cell=0x8072fb0) at newlisp.c:1058

#20 0x0804b07c in evaluateStream (stream=0xbffff400, outDevice=2, flag=0) at newlisp.c:855

#21 0x0804aeca in executeCommandLine (command=0xbffff400 "", outDevice=2, cmdStream=0xbffff460) at newlisp.c:833

#22 0x0804a801 in main (argc=1, argv=0xbffff5e4) at newlisp.c:663

(gdb)
-- (define? (Cornflakes))

newdep

#19
Lutz,



What version of readline do you use?

What does newlisp with readline?



I compiled newlisp without readline (and pjot also) NO problems,

WITH readline it crashes...



my readline version is: readline-4.3-i486-3

Pjots version: readline-4.3-i486-3



PS: does not have to be the problem! but just checking..



Reagrds, Norman
-- (define? (Cornflakes))

newdep

#20
Well i changed to readline-5.0 and still crashes..here the output...

What does newlisp do with readline regarding functions? malloc?



here my makefile







# makefile for newLISP v. 8.x.x on LINUX

#

# Note, that readline support may require different libraries on different OSs

#



OBJS = newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o

        nl-sock.o nl-import.o nl-xml.o nl-web.o nl-matrix.o nl-debug.o pcre.o



CFLAGS = -Wall -pedantic -Wno-uninitialized -c -O2 -g -DREADLINE -DLINUX

#CFLAGS = -Wall -pedantic -Wno-uninitialized -c -O2 -g -DLINUX



CC = gcc





default: $(OBJS)

#       $(CC) $(OBJS) -g -lm -ldl -lreadline -ltermcap -o newlisp

        $(CC) $(OBJS) -g -lm -ldl -lreadline -lncurses -o newlisp

#       $(CC) $(OBJS) -g -lm -ldl -o newlisp

#       strip newlisp



.c.o:

        $(CC) $(CFLAGS) $<



$(OBJS): primes.h protos.h makefile_linux















(gdb) bt

#0  0x400e7d81 in kill () from /lib/libc.so.6

#1  0x400e7b05 in raise () from /lib/libc.so.6

#2  0x400e905d in abort () from /lib/libc.so.6

#3  0x4011a46c in __libc_message () from /lib/libc.so.6

#4  0x40122df6 in malloc_printerr () from /lib/libc.so.6

#5  0x40121abf in _int_free () from /lib/libc.so.6

#6  0x401206df in free () from /lib/libc.so.6

#7  0x0804c268 in deleteList (cell=0x401d3ff4) at newlisp.c:1536

#8  0x0804b608 in evaluateExpression (cell=0x80a3fc0) at newlisp.c:1112

#9  0x08050059 in evaluateBlock (cell=0x80736f0) at newlisp.c:3966

#10 0x080508ce in p_dolist (params=0x80731d0) at newlisp.c:4246

#11 0x0804b832 in evaluateExpression (cell=0x80731b0) at newlisp.c:1058

#12 0x08050059 in evaluateBlock (cell=0x80731b0) at newlisp.c:3966

#13 0x080503c5 in repeat (params=0x8073150, type=2) at newlisp.c:4094

#14 0x080502d1 in p_until (params=0x8073150) at newlisp.c:4060

#15 0x0804b832 in evaluateExpression (cell=0x8073140) at newlisp.c:1058

#16 0x0804b07c in evaluateStream (stream=0xbffff3e0, outDevice=0, flag=1) at newlisp.c:855

#17 0x0804d8ac in loadFile (fileName=0x8096648 "rss-ticker2.lsp", offset=0, encryptFlag=134683484) at newlisp.c:2446

#18 0x08050bc1 in p_load (params=0x8071d40) at newlisp.c:4366

#19 0x0804b832 in evaluateExpression (cell=0x8072fb0) at newlisp.c:1058

#20 0x0804b07c in evaluateStream (stream=0xbffff4c0, outDevice=2, flag=0) at newlisp.c:855

#21 0x0804aeca in executeCommandLine (command=0xbffff4c0 "", outDevice=2, cmdStream=0xbffff520) at newlisp.c:833

#22 0x0804a801 in main (argc=1, argv=0xbffff6a4) at newlisp.c:663



(gdb) bt full

#0  0x400e7d81 in kill () from /lib/libc.so.6

No symbol table info available.

#1  0x400e7b05 in raise () from /lib/libc.so.6

No symbol table info available.

#2  0x400e905d in abort () from /lib/libc.so.6

No symbol table info available.

#3  0x4011a46c in __libc_message () from /lib/libc.so.6

No symbol table info available.

#4  0x40122df6 in malloc_printerr () from /lib/libc.so.6

No symbol table info available.

#5  0x40121abf in _int_free () from /lib/libc.so.6

No symbol table info available.

#6  0x401206df in free () from /lib/libc.so.6

No symbol table info available.

#7  0x0804c268 in deleteList (cell=0x401d3ff4) at newlisp.c:1536

        next = (CELL *) 0x401d3ff4

#8  0x0804b608 in evaluateExpression (cell=0x80a3fc0) at newlisp.c:1112

        result = (CELL *) 0x80a6c10

        args = (CELL *) 0x8073700

        pCell = (CELL *) 0x401d59c0

        resultIdxSave = 4

#9  0x08050059 in evaluateBlock (cell=0x80736f0) at newlisp.c:3966

        result = (CELL *) 0x0

#10 0x080508ce in p_dolist (params=0x80731d0) at newlisp.c:4246

        cell = (CELL *) 0x3

        list = (CELL *) 0x8073340

        symbol = (SYMBOL *) 0x809f090

#11 0x0804b832 in evaluateExpression (cell=0x80731b0) at newlisp.c:1058

        result = (CELL *) 0x80731b0

        args = (CELL *) 0x80731e0

        pCell = (CELL *) 0x8071e00

        resultIdxSave = 2

#12 0x08050059 in evaluateBlock (cell=0x80731b0) at newlisp.c:3966

        result = (CELL *) 0x0

#13 0x080503c5 in repeat (params=0x8073150, type=2) at newlisp.c:4094

        result = (CELL *) 0x2

        cell = (CELL *) 0x0

        resultIdxSave = 2

#14 0x080502d1 in p_until (params=0x8073150) at newlisp.c:4060

No locals.

#15 0x0804b832 in evaluateExpression (cell=0x8073140) at newlisp.c:1058

        result = (CELL *) 0x1

        args = (CELL *) 0x8073160

        pCell = (CELL *) 0x8071d90

        resultIdxSave = 2

#16 0x0804b07c in evaluateStream (stream=0xbffff3e0, outDevice=0, flag=1) at newlisp.c:855

---Type <return> to continue, or q <return> to quit---

        program = (CELL *) 0x8073000

        eval = (CELL *) 0x80731c0

        resultIdxSave = 1

        result = 1

#17 0x0804d8ac in loadFile (fileName=0x8096648 "rss-ticker2.lsp", offset=0, encryptFlag=134683484) at newlisp.c:2446

        result = (CELL *) 0x0

        stream = {handle = 6, ptr = 0x809add7 "nn(println default)n(exit)n",

  buffer = 0x809a598 "#!/usr/bin/newlispn;;n;; RSS Ticker v1.0 (c) Norman 2004n;;n;; Displays RSS Feed titels in your terminal screenn;;

 by using tput codes.n;;n;; Linux terminal version with ANSI and tput requiredn;; n;;n"..., position = 0, size = 18432}

        errNo = 0

        dataLen = 0

        errorJumpSave = {{__jmpbuf = {134709576, -1073744220, -1073744588, -1073744296, -1073744640, 134522561}, __mask_was_saved = 0,

    __saved_mask = {__val = {0 <repeats 32 times>}}}}

        key = "pôÿ¿00000000àóÿ¿@óÿ¿"

#18 0x08050bc1 in p_load (params=0x8071d40) at newlisp.c:4366

        fileName = 0x8096648 "rss-ticker2.lsp"

        result = (CELL *) 0x0

#19 0x0804b832 in evaluateExpression (cell=0x8072fb0) at newlisp.c:1058

        result = (CELL *) 0x1

        args = (CELL *) 0x8072fc0

        pCell = (CELL *) 0x8072920

        resultIdxSave = 1

#20 0x0804b07c in evaluateStream (stream=0xbffff4c0, outDevice=2, flag=0) at newlisp.c:855

        program = (CELL *) 0x8071d60

        eval = (CELL *) 0x8071d40

        resultIdxSave = 0

        result = 1

#21 0x0804aeca in executeCommandLine (command=0xbffff4c0 "", outDevice=2, cmdStream=0xbffff520) at newlisp.c:833

        stream = {handle = 0, ptr = 0x8096798 "", buffer = 0x8096780 "(load "rss-ticker2.lsp")", position = 0, size = 2072}

#22 0x0804a801 in main (argc=1, argv=0xbffff6a4) at newlisp.c:663

        command = "c22304b224Wf@¨÷04@ ", '' <repeats 11 times>, ":þf@d«f@t#f@¨÷04@b000000214ý04@Ðý04@Ø_01@|f01

@00000000$öÿ¿230u00@Ý22204b216ÿw01À21204bàõÿ¿(f01@05000000Ðý04@0100000000000000010000

00211Ëf@àõÿ¿ô?35@00000000¤öÿ¿øõÿ¿216ÿw01Pöÿ¿Ðd01@Ý22204bÕ÷ÿ¿Îð21@¤235f@¨÷04@øõÿ¿uBr@ô?35@¬öÿ¿30öÿ¿ºn04@Ø_

01@Xk01@30"...

        cmdStream = {handle = 0, ptr = 0x0, buffer = 0x0, position = 0, size = 0}

        idx = 1

        cmd = 0x8096780 "(load "rss-ticker2.lsp")"

(gdb)
-- (define? (Cornflakes))

pjot

#21
I receive the same crashes.



But if I compile newLisp WITHOUT readline, it all runs well.



Continuing...

newdep

#22
Okay I compiled newlisp with the latest readline and ncurses

still got the problem..
-- (define? (Cornflakes))

newdep

#23
Lutz,



Without any strange options.. here a simple debug of get-url

like this -> (goes wrong!) (and below also one thats oke!!)



(setq url (get-url "http://www.newlisp.org/rss.cgi?News">http://www.newlisp.org/rss.cgi?News"))







s$gdb newlisp

GNU gdb 6.3

Copyright 2004 Free Software Foundation, Inc.

GDB is free software, covered by the GNU General Public License, and you are

welcome to change it and/or distribute copies of it under certain conditions.

Type "show copying" to see the conditions.

There is absolutely no warranty for GDB.  Type "show warranty" for details.

This GDB was configured as "i486-slackware-linux"...Using host libthread_db library "/lib/libthread_db.so.1".



(gdb) run

Starting program: /usr/bin/newlisp

newLISP v.8.7.6 on linux, execute 'newlisp -h' for more info.



> (setq url (get-url "http://www.newlisp.org/rss.cgi?News">http://www.newlisp.org/rss.cgi?News"))



Program received signal SIGSEGV, Segmentation fault.

0x400e2dc9 in malloc_consolidate () from /lib/libc.so.6

(gdb) bt

#0  0x400e2dc9 in malloc_consolidate () from /lib/libc.so.6

#1  0x400e2493 in _int_malloc () from /lib/libc.so.6

#2  0x400e1548 in malloc () from /lib/libc.so.6

#3  0x0804c730 in allocMemory (nbytes=2325) at newlisp.c:1594

#4  0x0804c501 in copyCell (cell=0x401969c0) at newlisp.c:1484

#5  0x0804fbeb in setDefine (symbol=0x80aecd8, params=0x6d783f3c, type=1702240364) at newlisp.c:3597

#6  0x0804fa27 in p_setq (params=0x808bc00) at newlisp.c:3516

#7  0x0804bc22 in evaluateExpression (cell=0x808ba70) at newlisp.c:1058

#8  0x0804b46c in evaluateStream (stream=0xbffff440, outDevice=2, flag=0) at newlisp.c:855

#9  0x0804b2ba in executeCommandLine (command=0xbffff440 "", outDevice=2, cmdStream=0xbffff4a0) at newlisp.c:833

#10 0x0804abf1 in main (argc=1, argv=0xbffff624) at newlisp.c:663

(gdb) bt full

#0  0x400e2dc9 in malloc_consolidate () from /lib/libc.so.6

No symbol table info available.

#1  0x400e2493 in _int_malloc () from /lib/libc.so.6

No symbol table info available.

#2  0x400e1548 in malloc () from /lib/libc.so.6

No symbol table info available.

#3  0x0804c730 in allocMemory (nbytes=2325) at newlisp.c:1594

        ptr = (void *) 0x40194ff4

#4  0x0804c501 in copyCell (cell=0x401969c0) at newlisp.c:1484

        newCell = (CELL *) 0x808bc40

#5  0x0804fbeb in setDefine (symbol=0x80aecd8, params=0x6d783f3c, type=1702240364) at newlisp.c:3597

        cell = (CELL *) 0x808bc00

#6  0x0804fa27 in p_setq (params=0x808bc00) at newlisp.c:3516

        symbol = (SYMBOL *) 0x6576206c

        next = (CELL *) 0x808a800

#7  0x0804bc22 in evaluateExpression (cell=0x808ba70) at newlisp.c:1058

        result = (CELL *) 0x1

        args = (CELL *) 0x808ba80

        pCell = (CELL *) 0x401969c0

        resultIdxSave = 1

#8  0x0804b46c in evaluateStream (stream=0xbffff440, outDevice=2, flag=0) at newlisp.c:855

        program = (CELL *) 0x808a820

        eval = (CELL *) 0x808a800

        resultIdxSave = 0

        result = 1

#9  0x0804b2ba in executeCommandLine (command=0xbffff440 "", outDevice=2, cmdStream=0xbffff4a0) at newlisp.c:833

        stream = {handle = 0, ptr = 0x80adcd2 "", buffer = 0x80adc98 "(setq url (get-url "http://www.newlisp.org/rss.cgi?News">http://www.newlisp.org/rss.cgi?News"))",

  position = 0, size = 2106}

#10 0x0804abf1 in main (argc=1, argv=0xbffff624) at newlisp.c:663

        command = "Õ22504b224gb@30õ04@ ", '' <repeats 11 times>, ":16t@d»b@t3b@30õ04@06000000,ø04@hø04@Ø_0

1@|f01@00000000¤õÿ¿230u00@>22504b216ÿw012021404b`õÿ¿(f01@04000000hø04@0100000000000000

001000000211Ûb@`õÿ¿ôO31@00000000$öÿ¿xõÿ¿216ÿw01Ðõÿ¿Ðd01@>22504b`÷ÿ¿Î0016@¤­b@30õ04@xõÿ¿uRt@ôO31@,öÿ¿2

30õÿ¿ºn04@Ø_01@Xk01@230"...

        cmdStream = {handle = 0, ptr = 0x0, buffer = 0x0, position = 0, size = 0}

        idx = 1

        cmd = 0x80adc98 "(setq url (get-url "http://www.newlisp.org/rss.cgi?News">http://www.newlisp.org/rss.cgi?News"))"

(gdb)











AND without !!! the setq url !!! is works oke !!!











$gdb newlisp

GNU gdb 6.3

Copyright 2004 Free Software Foundation, Inc.

GDB is free software, covered by the GNU General Public License, and you are

welcome to change it and/or distribute copies of it under certain conditions.

Type "show copying" to see the conditions.

There is absolutely no warranty for GDB.  Type "show warranty" for details.

This GDB was configured as "i486-slackware-linux"...Using host libthread_db library "/lib/libthread_db.so.1".



(gdb) run

Starting program: /usr/bin/newlisp

newLISP v.8.7.6 on linux, execute 'newlisp -h' for more info.



> (get-url "http://www.newlisp.org/rss.cgi?News">http://www.newlisp.org/rss.cgi?News")

[text]<?xml version="1.0" encoding="UTF-8"?>

<!-- generator="newLISP Wiki/CMS rss.cgi v. 1.0" -->

<rss version="0.92">

    <channel>

        <title>newLISP</title>

        <description>News and Comments</description>

        <link>http://newlisp.org</link>

        <copyright>copyright (c) Lutz Mueller, 2005. All rights reserved.</copyright>

    <item>

        <title>development version newLISP 8.7.6</title>

        <description></description>

        <link>http://newlisp.org/index.cgi?find=Lutz%20on%20Mon%20Jan%20%202%2019:59:52%202006">http://newlisp.org/index.cgi?find=Lutz% ... :52%202006">http://newlisp.org/index.cgi?find=Lutz%20on%20Mon%20Jan%20%202%2019:59:52%202006 </link>

    </item>

    <item>

        <title>development version newLISP 8.7.5</title>

        <description></description>

        <link>http://newlisp.org/index.cgi?find=Lutz%20on%20Fri%20Dec%2023%2017:11:58%202005">http://newlisp.org/index.cgi?find=Lutz% ... :58%202005">http://newlisp.org/index.cgi?find=Lutz%20on%20Fri%20Dec%2023%2017:11:58%202005 </link>

    </item>

    <item>

        <title>development version newLISP 8.7.4</title>

        <description></description>

        <link>http://newlisp.org/index.cgi?find=Lutz%20on%20Mon%20Dec%20%205%2015:14:18%202005">http://newlisp.org/index.cgi?find=Lutz% ... :18%202005">http://newlisp.org/index.cgi?find=Lutz%20on%20Mon%20Dec%20%205%2015:14:18%202005 </link>

    </item>

    <item>

        <title>newLISP coding competition</title>

        <description></description>

        <link>http://newlisp.org/index.cgi?find=lutz%20on%20Sat%20Dec%20%203%2002:37:41%202005">http://newlisp.org/index.cgi?find=lutz% ... :41%202005">http://newlisp.org/index.cgi?find=lutz%20on%20Sat%20Dec%20%203%2002:37:41%202005 </link>

    </item>

    <item>

        <title>Users about newLISP</title>

        <description></description>

        <link>http://newlisp.org/index.cgi?find=Lutz%20on%20Fri%20Dec%20%202%2019:54:41%202005">http://newlisp.org/index.cgi?find=Lutz% ... :41%202005">http://newlisp.org/index.cgi?find=Lutz%20on%20Fri%20Dec%20%202%2019:54:41%202005 </link>

    </item>

    <item>

        <title>development version newLISP 8.7.3</title>

        <description></description>

        <link>http://newlisp.org/index.cgi?find=Lutz%20on%20Sun%20Nov%2027%2016:46:06%202005">http://newlisp.org/index.cgi?find=Lutz% ... :06%202005">http://newlisp.org/index.cgi?find=Lutz%20on%20Sun%20Nov%2027%2016:46:06%202005 </link>

    </item>

    <item>

        <title>repost development version newLISP 8.7.2</title>

        <description></description>

        <link>http://newlisp.org/index.cgi?find=Lutz%20on%20Sun%20Nov%2020%2018:58:18%202005">http://newlisp.org/index.cgi?find=Lutz% ... :18%202005">http://newlisp.org/index.cgi?find=Lutz%20on%20Sun%20Nov%2020%2018:58:18%202005 </link>

    </item>

    <item>

        <title>development version newLISP 8.7.2</title>

        <description></description>

        <link>http://newlisp.org/index.cgi?find=Lutz%20Mueller%20on%20Sun%20Nov%2020%2017:01:14%202005">http://newlisp.org/index.cgi?find=Lutz% ... :14%202005">http://newlisp.org/index.cgi?find=Lutz%20Mueller%20on%20Sun%20Nov%2020%2017:01:14%202005 </link>

    </item>

    <item>

        <title>newLISP release version 8.7.1</title>

        <description></description>

        <link>http://newlisp.org/index.cgi?find=lutz%20Mueller%20on%20Mon%20Nov%20%207%2017:47:50%202005">http://newlisp.org/index.cgi?find=lutz% ... :50%202005">http://newlisp.org/index.cgi?find=lutz%20Mueller%20on%20Mon%20Nov%20%207%2017:47:50%202005 </link>

    </item>

    </channel>

</rss>

[/text]

> bt

nil

>
-- (define? (Cornflakes))

pjot

#24
Okay, I found something very interesting.



1) Start a new xTerm, then start newlisp. From the newLisp console, I run this:



(setq url (get-url "http://www.newlisp.org/rss.cgi?News">http://www.newlisp.org/rss.cgi?News"))



This is the result:
Quote
peter@Solarstriker:~$ newlisp

newLISP v.8.7.6 on linux, execute 'newlisp -h' for more info.



> (setq url (get-url "http://www.newlisp.org/rss.cgi?News">http://www.newlisp.org/rss.cgi?News"))

peter@Solarstriker:~$


As you see, I arrive back to the Linux prompt immediately, without results.



2) Start a new xTerm, then start newLisp. From the newLisp console, I run this:



(get-url "http://www.newlisp.org/rss.cgi?News">http://www.newlisp.org/rss.cgi?News")



This is the result:
Quote
peter@Solarstriker:~$ newlisp

newLISP v.8.7.6 on linux, execute 'newlisp -h' for more info.



> (get-url "http://www.newlisp.org/rss.cgi?News">http://www.newlisp.org/rss.cgi?News")

[text]<?xml version="1.0" encoding="UTF-8"?>

<!-- generator="newLISP Wiki/CMS rss.cgi v. 1.0" -->

<rss version="0.92">

    <channel>

        <title>newLISP</title>

        <description>News and Comments</description>

        <link>http://newlisp.org</link>

        <copyright>copyright (c) Lutz Mueller, 2005. All rights reserved.</copyright>

    <item>

        <title>development version newLISP 8.7.6</title>

        <description></description>

        <link>http://newlisp.org/index.cgi?find=Lutz%20on%20Mon%20Jan%20%202%2019:59:52%202006">http://newlisp.org/index.cgi?find=Lutz% ... :52%202006">http://newlisp.org/index.cgi?find=Lutz%20on%20Mon%20Jan%20%202%2019:59:52%202006 </link>

    </item>

    <item>



...... ETCETERA......



2020%2017:01:14%202005 </link>

    </item>

    <item>

        <title>newLISP release version 8.7.1</title>

        <description></description>

        <link>http://newlisp.org/index.cgi?find=lutz%20Mueller%20on%20Mon%20Nov%20%207%2017:47:50%202005">http://newlisp.org/index.cgi?find=lutz% ... :50%202005">http://newlisp.org/index.cgi?find=lutz%20Mueller%20on%20Mon%20Nov%20%207%2017:47:50%202005 </link>

    </item>

    </channel>

</rss>

[/text]


Look at how the result ends: with a [/text], which is correct. Now, if I run the first query in this same session again, this is the result:


Quote
> (setq url (get-url "http://www.newlisp.org/rss.cgi?News">http://www.newlisp.org/rss.cgi?News"))

[text]<?xml version="1.0" encoding="UTF-8"?>

<!-- generator="newLISP Wiki/CMS rss.cgi v. 1.0" -->

<rss version="0.92">

    <channel>

        <title>newLISP</title>

        <description>News and Comments</description>

        <link>http://newlisp.org</link>

        <copyright>copyright (c) Lutz Mueller, 2005. All rights reserved.</copyright>

    <item>

        <title>development version newLISP 8.7.6</title>

        <description></description>

        <link>http://newlisp.org/index.cgi?find=Lutz%20on%20Mon%20Jan%20%202%2019:59:52%202006">http://newlisp.org/index.cgi?find=Lutz% ... :52%202006">http://newlisp.org/index.cgi?find=Lutz%20on%20Mon%20Jan%20%202%2019:59:52%202006 </link>

    </item>

    <item>

        <title>development version newLISP 8.7.5</title>

        <description></description>



.....ETCETERA.....



    </item>

    <item>

        <title>newLISP release version 8.7.1</title>

        <description></description>

        <link>http://newlisp.org/index.cgi?find=lutz%20Mueller%20on%20Mon%20Nov%20%207%2017:47:50%202005">http://newlisp.org/index.cgi?find=lutz% ... :50%202005">http://newlisp.org/index.cgi?find=lutz%20Mueller%20on%20Mon%20Nov%20%207%2017:47:50%202005 </link>

    </item>

    </channel>

</rss>

!02005 <á




It seems to work, but look at how the query ends: with !02005<á, instead of [/text].





Peter

newdep

#25
yes thats correct I have everytime different chracters just befor [/text]

sometimes highasci sometimes other things..

I cant explain that... a LOCALE issue?
-- (define? (Cornflakes))

pjot

#26
Same problems occur when I compile newLisp WITHOUT support for READLINE.



Peter

pjot

#27
Using Valgrind:


Quote
peter@Solarstriker:~$ valgrind --leak-check=full newlisp

==28837== Memcheck, a memory error detector.

==28837== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.

==28837== Using LibVEX rev 1471, a library for dynamic binary translation.

==28837== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.

==28837== Using valgrind-3.1.0, a dynamic binary instrumentation framework.

==28837== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.

==28837== For more details, rerun with: -v

==28837==

newLISP v.8.7.6 on linux, execute 'newlisp -h' for more info.



> (setq url (get-url "http://www.newlisp.org/rss.cgi?News">http://www.newlisp.org/rss.cgi?News"))                                                          

==28837== Invalid write of size 1

==28837==    at 0x8062F63: getPutPostUrl (nl-web.c:525)

==28837==    by 0x80625E0: p_getUrl (nl-web.c:179)

==28837==    by 0x804B681: evaluateExpression (newlisp.c:1058)

==28837==    by 0x804F642: setDefine (newlisp.c:3597)

==28837==    by 0x804F486: p_setq (newlisp.c:3516)

==28837==    by 0x804B681: evaluateExpression (newlisp.c:1058)

==28837==    by 0x804AECB: evaluateStream (newlisp.c:855)

==28837==    by 0x804AD19: executeCommandLine (newlisp.c:833)

==28837==    by 0x804A645: main (newlisp.c:686)

==28837==  Address 0x41D7FAC is 0 bytes after a block of size 2,324 alloc'd

==28837==    at 0x401C811: realloc (vg_replace_malloc.c:306)

==28837==    by 0x806312B: getPutPostUrl (nl-web.c:482)

==28837==    by 0x80625E0: p_getUrl (nl-web.c:179)

==28837==    by 0x804B681: evaluateExpression (newlisp.c:1058)

==28837==    by 0x804F642: setDefine (newlisp.c:3597)

==28837==    by 0x804F486: p_setq (newlisp.c:3516)

==28837==    by 0x804B681: evaluateExpression (newlisp.c:1058)

==28837==    by 0x804AECB: evaluateStream (newlisp.c:855)

==28837==    by 0x804AD19: executeCommandLine (newlisp.c:833)

==28837==    by 0x804A645: main (newlisp.c:686)

==28837==

==28837== Invalid read of size 1

==28837==    at 0x401D500: memcpy (mac_replace_strmem.c:394)

==28837==    by 0x804BF74: copyCell (newlisp.c:1485)

==28837==    by 0x804F64A: setDefine (newlisp.c:3597)

==28837==    by 0x804F486: p_setq (newlisp.c:3516)

==28837==    by 0x804B681: evaluateExpression (newlisp.c:1058)

==28837==    by 0x804AECB: evaluateStream (newlisp.c:855)

==28837==    by 0x804AD19: executeCommandLine (newlisp.c:833)

==28837==    by 0x804A645: main (newlisp.c:686)

==28837==  Address 0x41D7FAC is 0 bytes after a block of size 2,324 alloc'd

==28837==    at 0x401C811: realloc (vg_replace_malloc.c:306)

==28837==    by 0x806312B: getPutPostUrl (nl-web.c:482)

==28837==    by 0x80625E0: p_getUrl (nl-web.c:179)

==28837==    by 0x804B681: evaluateExpression (newlisp.c:1058)

==28837==    by 0x804F642: setDefine (newlisp.c:3597)

==28837==    by 0x804F486: p_setq (newlisp.c:3516)

==28837==    by 0x804B681: evaluateExpression (newlisp.c:1058)

==28837==    by 0x804AECB: evaluateStream (newlisp.c:855)

==28837==    by 0x804AD19: executeCommandLine (newlisp.c:833)

==28837==    by 0x804A645: main (newlisp.c:686)




I changed line 525 in 'nl-web.c' to:



*(resultPtr + resultSize - 1) = 0;





Now it works.



Peter

pjot

#28
I still have the invalid read though:


Quote
newLISP v.8.7.6 on linux, execute 'newlisp -h' for more info.



>  (setq url (get-url "http://www.newlisp.org/rss.cgi?News">http://www.newlisp.org/rss.cgi?News"))

==29098== Invalid read of size 1

==29098==    at 0x401D500: memcpy (mac_replace_strmem.c:394)

==29098==    by 0x804C124: copyCell (newlisp.c:1485)

==29098==    by 0x804F7FA: setDefine (newlisp.c:3597)

==29098==    by 0x804F636: p_setq (newlisp.c:3516)

==29098==    by 0x804B831: evaluateExpression (newlisp.c:1058)

==29098==    by 0x804B07B: evaluateStream (newlisp.c:855)

==29098==    by 0x804AEC9: executeCommandLine (newlisp.c:833)

==29098==    by 0x804A800: main (newlisp.c:663)

==29098==  Address 0x4232CC4 is 0 bytes after a block of size 2,324 alloc'd

==29098==    at 0x401C811: realloc (vg_replace_malloc.c:306)

==29098==    by 0x80632DB: getPutPostUrl (nl-web.c:482)

==29098==    by 0x8062790: p_getUrl (nl-web.c:179)

==29098==    by 0x804B831: evaluateExpression (newlisp.c:1058)

==29098==    by 0x804F7F2: setDefine (newlisp.c:3597)

==29098==    by 0x804F636: p_setq (newlisp.c:3516)

==29098==    by 0x804B831: evaluateExpression (newlisp.c:1058)

==29098==    by 0x804B07B: evaluateStream (newlisp.c:855)

==29098==    by 0x804AEC9: executeCommandLine (newlisp.c:833)

==29098==    by 0x804A800: main (newlisp.c:663)


This seems to be caused by the fact that this line in newlisp.c (1485);



memcpy((void *)newCell->contents,(void*)cell->contents, (UINT)cell->aux);





...copies 1 byte too much. So the (UINT)cell-aux is not correct.



Peter

Lutz

#29
Can you check if you can see the same thing in 8.7.1? 'get-url' had changes on 8.7.2/3.



Thanks



Lutz