newlisp with libmicrohttpd and libevent(evhttp)

Started by irr, September 12, 2012, 06:22:53 AM

Previous topic - Next topic

irr

Hi,



  I am trying to use libmicrohttd with newlisp and unfortunately, after about 4089 function calls, the code fail with [ERR: call or result stack overflow : MHD_create_response_from_data@7F6AF7B03D80] using:

  > ab -n 4089 -c 100 http://localhost:8081">http://localhost:8081



  The code is very simple: https://github.com/irr/newlisp-labs/blob/master/microhttpd/hello.lsp">https://github.com/irr/newlisp-labs/blo ... /hello.lsp">https://github.com/irr/newlisp-labs/blob/master/microhttpd/hello.lsp

  (just translated from C version: https://github.com/irr/newlisp-labs/blob/master/microhttpd/hello.c">https://github.com/irr/newlisp-labs/blo ... pd/hello.c">https://github.com/irr/newlisp-labs/blob/master/microhttpd/hello.c)



  The same happens with (using libevent + evhttp):

  https://github.com/irr/newlisp-labs/blob/master/libs/evhttp.lsp">https://github.com/irr/newlisp-labs/blo ... evhttp.lsp">https://github.com/irr/newlisp-labs/blob/master/libs/evhttp.lsp



  Any help?



  Ivan



Info:

Ubuntu 12.04

> uname -a

Linux irrlab 3.2.0-30-generic #48-Ubuntu SMP Fri Aug 24 16:52:48 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

> newlisp -v

newLISP v.10.4.3 64-bit on Linux IPv4/6 UTF-8 libffi.



> newlisp hello.lsp

   ; after ab -n 4090 -c 100 localhost:8081



ERR: call or result stack overflow : MHD_create_response_from_data@7F6AF7B03D80

called from user defined function process_request



ERR: call or result stack overflow : read-key@426F60

*** longjmp causes uninitialized stack frame ***: newlisp terminated

======= Backtrace: =========

/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x37)[0x7f6af8300007]

/lib/x86_64-linux-gnu/libc.so.6(+0x108f7d)[0x7f6af82fff7d]

/lib/x86_64-linux-gnu/libc.so.6(__longjmp_chk+0x33)[0x7f6af82ffee3]

newlisp[0x407606]

newlisp[0x40ac4b]

newlisp[0x40f2dc]

newlisp[0x40f4d8]

newlisp[0x406a64]

/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7f6af821876d]

newlisp[0x406b45]

======= Memory map: ========

00400000-0044f000 r-xp 00000000 08:02 11277047                           /usr/bin/newlisp-10.4.3

0064e000-0064f000 r--p 0004e000 08:02 11277047                           /usr/bin/newlisp-10.4.3

0064f000-00653000 rw-p 0004f000 08:02 11277047                           /usr/bin/newlisp-10.4.3

00653000-00655000 rw-p 00000000 00:00 0

01b29000-01b4a000 rw-p 00000000 00:00 0                                  [heap]

7f6af0000000-7f6af032b000 rw-p 00000000 00:00 0

7f6af032b000-7f6af4000000 ---p 00000000 00:00 0

7f6af6ec8000-7f6af6edd000 r-xp 00000000 08:02 1314307                    /lib/x86_64-linux-gnu/libgcc_s.so.1

7f6af6edd000-7f6af70dc000 ---p 00015000 08:02 1314307                    /lib/x86_64-linux-gnu/libgcc_s.so.1

7f6af70dc000-7f6af70dd000 r--p 00014000 08:02 1314307                    /lib/x86_64-linux-gnu/libgcc_s.so.1

7f6af70dd000-7f6af70de000 rw-p 00015000 08:02 1314307                    /lib/x86_64-linux-gnu/libgcc_s.so.1

7f6af70de000-7f6af70df000 ---p 00000000 00:00 0

7f6af70df000-7f6af78df000 rw-p 00000000 00:00 0

7f6af78df000-7f6af78f7000 r-xp 00000000 08:02 1314366                    /lib/x86_64-linux-gnu/libpthread-2.15.so

7f6af78f7000-7f6af7af6000 ---p 00018000 08:02 1314366                    /lib/x86_64-linux-gnu/libpthread-2.15.so

7f6af7af6000-7f6af7af7000 r--p 00017000 08:02 1314366                    /lib/x86_64-linux-gnu/libpthread-2.15.so

7f6af7af7000-7f6af7af8000 rw-p 00018000 08:02 1314366                    /lib/x86_64-linux-gnu/libpthread-2.15.so

7f6af7af8000-7f6af7afc000 rw-p 00000000 00:00 0

7f6af7afc000-7f6af7b06000 r-xp 00000000 08:02 11272629                   /usr/lib/libmicrohttpd.so.5.2.1

7f6af7b06000-7f6af7d05000 ---p 0000a000 08:02 11272629                   /usr/lib/libmicrohttpd.so.5.2.1

7f6af7d05000-7f6af7d06000 r--p 00009000 08:02 11272629                   /usr/lib/libmicrohttpd.so.5.2.1

7f6af7d06000-7f6af7d07000 rw-p 0000a000 08:02 11272629                   /usr/lib/libmicrohttpd.so.5.2.1

7f6af7d07000-7f6af7fd0000 r--p 00000000 08:02 11278545                   /usr/lib/locale/locale-archive

7f6af7fd0000-7f6af7ff2000 r-xp 00000000 08:02 1314383                    /lib/x86_64-linux-gnu/libtinfo.so.5.9

7f6af7ff2000-7f6af81f2000 ---p 00022000 08:02 1314383                    /lib/x86_64-linux-gnu/libtinfo.so.5.9

7f6af81f2000-7f6af81f6000 r--p 00022000 08:02 1314383                    /lib/x86_64-linux-gnu/libtinfo.so.5.9

7f6af81f6000-7f6af81f7000 rw-p 00026000 08:02 1314383                    /lib/x86_64-linux-gnu/libtinfo.so.5.9

7f6af81f7000-7f6af83aa000 r-xp 00000000 08:02 1314286                    /lib/x86_64-linux-gnu/libc-2.15.so

7f6af83aa000-7f6af85a9000 ---p 001b3000 08:02 1314286                    /lib/x86_64-linux-gnu/libc-2.15.so

7f6af85a9000-7f6af85ad000 r--p 001b2000 08:02 1314286                    /lib/x86_64-linux-gnu/libc-2.15.so

7f6af85ad000-7f6af85af000 rw-p 001b6000 08:02 1314286                    /lib/x86_64-linux-gnu/libc-2.15.so

7f6af85af000-7f6af85b4000 rw-p 00000000 00:00 0

7f6af85b4000-7f6af85bb000 r-xp 00000000 08:02 11279738                   /usr/lib/x86_64-linux-gnu/libffi.so.6.0.0

7f6af85bb000-7f6af87ba000 ---p 00007000 08:02 11279738                   /usr/lib/x86_64-linux-gnu/libffi.so.6.0.0

7f6af87ba000-7f6af87bb000 r--p 00006000 08:02 11279738                   /usr/lib/x86_64-linux-gnu/libffi.so.6.0.0

7f6af87bb000-7f6af87bc000 rw-p 00007000 08:02 11279738                   /usr/lib/x86_64-linux-gnu/libffi.so.6.0.0

7f6af87bc000-7f6af87f5000 r-xp 00000000 08:02 1314369                    /lib/x86_64-linux-gnu/libreadline.so.6.2

7f6af87f5000-7f6af89f5000 ---p 00039000 08:02 1314369                    /lib/x86_64-linux-gnu/libreadline.so.6.2

7f6af89f5000-7f6af89f7000 r--p 00039000 08:02 1314369                    /lib/x86_64-linux-gnu/libreadline.so.6.2

7f6af89f7000-7f6af89fd000 rw-p 0003b000 08:02 1314369                    /lib/x86_64-linux-gnu/libreadline.so.6.2

7f6af89fd000-7f6af89fe000 rw-p 00000000 00:00 0

7f6af89fe000-7f6af8a00000 r-xp 00000000 08:02 1314299                    /lib/x86_64-linux-gnu/libdl-2.15.so

7f6af8a00000-7f6af8c00000 ---p 00002000 08:02 1314299                    /lib/x86_64-linux-gnu/libdl-2.15.so

7f6af8c00000-7f6af8c01000 r--p 00002000 08:02 1314299                    /lib/x86_64-linux-gnu/libdl-2.15.so

7f6af8c01000-7f6af8c02000 rw-p 00003000 08:02 1314299                    /lib/x86_64-linux-gnu/libdl-2.15.so

7f6af8c02000-7f6af8cfb000 r-xp 00000000 08:02 1314318                    /lib/x86_64-linux-gnu/libm-2.15.so

7f6af8cfb000-7f6af8efa000 ---p 000f9000 08:02 1314318                    /lib/x86_64-linux-gnu/libm-2.15.so

7f6af8efa000-7f6af8efb000 r--p 000f8000 08:02 1314318                    /lib/x86_64-linux-gnu/libm-2.15.so

7f6af8efb000-7f6af8efc000 rw-p 000f9000 08:02 1314318                    /lib/x86_64-linux-gnu/libm-2.15.so

7f6af8efc000-7f6af8f1e000 r-xp 00000000 08:02 1314266                    /lib/x86_64-linux-gnu/ld-2.15.so

7f6af907c000-7f6af90be000 rw-p 00000000 00:00 0

7f6af90ff000-7f6af9104000 rw-p 00000000 00:00 0

7f6af9104000-7f6af910b000 r--s 00000000 08:02 11406096                   /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache

7f6af9119000-7f6af911e000 rw-p 00000000 00:00 0

7f6af911e000-7f6af911f000 r--p 00022000 08:02 1314266                    /lib/x86_64-linux-gnu/ld-2.15.so

7f6af911f000-7f6af9121000 rw-p 00023000 08:02 1314266                    /lib/x86_64-linux-gnu/ld-2.15.so

7fffbb85e000-7fffbb87f000 rw-p 00000000 00:00 0                          [stack]

7fffbb94a000-7fffbb94b000 r-xp 00000000 00:00 0                          [vdso]

ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]

Aborted (core dumped)

Lutz

#1
This is fixed in the current inprogess version - assuming you can compile yourself:



http://www.newlisp.org/downloads/development/inprogress/">http://www.newlisp.org/downloads/develo ... nprogress/">http://www.newlisp.org/downloads/development/inprogress/



There will be a maintenance release 10.4.4 by the end of this week.

irr

#2
"Fixed a result stack overflow problem on callback's."



Great news! I tried this version and everything is fine.



Thanks,



  Ivan