[plt-dev] segfault with mzscheme trunk

From: Kevin Tew (tewk at cs.utah.edu)
Date: Tue Jul 7 13:47:41 EDT 2009

Make sure you're using --vex-iropt-precise-memory-exns=yes in your 
valgrind options.
The default(3m) collector needs this.

Here is the valgrind line I commonly use.

valgrind --tool=memcheck --db-attach=yes 
--vex-iropt-precise-memory-exns=yes --leak-check=full --num-callers=40 
mzscheme/mzscheme3m

You can also run under gdb to get a stack trace.
just type
(gdb) handle SIGSEGV noprint nostop

before running.

Kevin

Holden Karau wrote:
> The code is at http://web2.0collage.com/slseg.tar.bz2
> When I run it on my x86_64 machine it segfaults, but doesn't on my
> 32bit x86 machine
> If I get rid of the HMAC-SHA1 stuffer it works.
> The error occures when I go to fetch anything in /app/
> I asked on #scheme and jonrafkind suggested I should e-mail this list
> Any suggestions?
>
> I tried running it inside valgrind (to see if it was doing funny
> things with the memory prior to the segfaul):
> valground output:
>    1.
>       valgrind:
>    2.
>       ==12909== Memcheck, a memory error detector.
>    3.
>       ==12909== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et al.
>    4.
>       ==12909== Using LibVEX rev 1884, a library for dynamic binary translation.
>    5.
>       ==12909== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP.
>    6.
>       ==12909== Using valgrind-3.4.1-Debian, a dynamic binary
> instrumentation framework.
>    7.
>       ==12909== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al.
>    8.
>       ==12909== For more details, rerun with: -v
>    9.
>       ==12909==
>   10.
>       --12909-- DWARF2 CFI reader: unhandled CFI instruction 0:10
>   11.
>       --12909-- DWARF2 CFI reader: unhandled CFI instruction 0:10
>   12.
>       ==12909== Invalid write of size 8
>   13.
>       ==12909==    at 0x59532C: symbol_bucket (symbol.c:162)
>   14.
>       ==12909==    by 0x595408:
> scheme_intern_exact_symbol_in_table_worker (symbol.c:394)
>   15.
>       ==12909==    by 0x545E58: read_compact (read.c:4871)
>   16.
>       ==12909==    by 0x544F97: read_compact (read.c:4566)
>   17.
>       ==12909==    by 0x546C33: read_compact_list (read.c:4993)
>   18.
>       ==12909==    by 0x545EE3: read_compact (read.c:4902)
>   19.
>       ==12909==    by 0x546D16: read_marshalled (read.c:5040)
>   20.
>       ==12909==    by 0x545E97: read_compact (read.c:4863)
>   21.
>       ==12909==    by 0x546251: read_compact (read.c:4797)
>   22.
>       ==12909==    by 0x544F97: read_compact (read.c:4566)
>   23.
>       ==12909==    by 0x544F97: read_compact (read.c:4566)
>   24.
>       ==12909==    by 0x546C33: read_compact_list (read.c:4993)
>   25.
>       ==12909==  Address 0x303e is not stack'd, malloc'd or (recently) free'd
>   26.
>       SIGSEGV fault on 0x303e
>   27.
>       ==12909==
>   28.
>       ==12909== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 8 from 1)
>   29.
>       ==12909== malloc/free: in use at exit: 4,322,196 bytes in 1,330 blocks.
>   30.
>       ==12909== malloc/free: 1,820 allocs, 490 frees, 5,220,024 bytes allocated.
>   31.
>       ==12909== For counts of detected errors, rerun with: -v
>   32.
>       ==12909== searching for pointers to 1,330 not-freed blocks.
>   33.
>       ==12909== checked 5,543,936 bytes.
>   34.
>       ==12909==
>   35.
>       ==12909== LEAK SUMMARY:
>   36.
>       ==12909==    definitely lost: 456 bytes in 11 blocks.
>   37.
>       ==12909==      possibly lost: 0 bytes in 0 blocks.
>   38.
>       ==12909==    still reachable: 4,321,740 bytes in 1,319 blocks.
>   39.
>       ==12909==         suppressed: 0 bytes in 0 blocks.
>   40.
>       ==12909== Rerun with --leak-check=full to see details of leaked memory.
>   41.
>       Aborted
>   42.
>       gdb:
>   43.
>       #0  scheme_gmp_tls_unload (s=0x7f5f3b8bd288, data=0x0) at ./gmp/gmp.c:5810
>   44.
>       #1  0x00000000005b593e in done_with_GC () at ./../src/thread.c:7384
>   45.
>       #2  0x00000000005e08b7 in garbage_collect (gc=0x946010,
> force_full=<value optimized out>) at ./newgc.c:3227
>   46.
>       #3  0x00000000005e42a2 in GC_malloc_one_tagged (s=<value
> optimized out>) at ./newgc.c:737
>   47.
>       #4  0x0000000000420523 in scheme_malloc_fail_ok (f=0x946010,
> s=0) at ./../src/salloc.c:407
>   48.
>       #5  0x00000000005c5d3f in scheme_make_vector (size=1151,
> fill=0x0) at ./../src/vector.c:140
>   49.
>       #6  0x0000000000544f6f in read_compact (port=0x7f5f3b8bddd8,
> use_stack=<value optimized out>) at ./../src/read.c:4563
>   50.
>       #7  0x0000000000546c34 in read_compact_list (c=30, proper=1,
> use_stack=<value optimized out>, port=0x7f5f3b8bddd8) at
> ./../src/read.c:4993
>   51.
>       #8  0x0000000000545ee4 in read_compact (port=0x7f5f3b8ccab8,
> use_stack=<value optimized out>) at ./../src/read.c:4902
>   52.
>       #9  0x0000000000546d17 in read_marshalled (type=100,
> port=0x7f5f3b8bddd8) at ./../src/read.c:5040
>   53.
>       #10 0x0000000000545298 in read_compact (port=0x7f5f3b8bddd8,
> use_stack=<value optimized out>) at ./../src/read.c:4650
>   54.
>       #11 0x00000000005466d0 in read_compact (port=0x7f5f3b8bddd8,
> use_stack=<value optimized out>) at ./../src/read.c:4897
>   55.
>       #12 0x0000000000546d17 in read_marshalled (type=3,
> port=0x7f5f3b8bddd8) at ./../src/read.c:5040
>   56.
>       #13 0x0000000000545e98 in read_compact (port=0x7f5f3b8ccab8,
> use_stack=<value optimized out>) at ./../src/read.c:4863
>   57.
>       #14 0x0000000000546c6e in read_compact_list (c=0, proper=0,
> use_stack=<value optimized out>, port=0x7f5f3b8bddd8) at
> ./../src/read.c:5002
>   58.
>       #15 0x0000000000545ee4 in read_compact (port=0x7f5f3b8ccab8,
> use_stack=<value optimized out>) at ./../src/read.c:4902
>   59.
>       #16 0x0000000000546d17 in read_marshalled (type=87,
> port=0x7f5f3b8bddd8) at ./../src/read.c:5040
>   60.
>       #17 0x000000000053e9c7 in read_inner_inner (port=0x7f5f3b8a2578,
> stxsrc=0x7f5f3b8a2480, ht=0x7f5f3b8dbe20, indentation=0x859490,
> params=0x7fff447bc6d0, comment_mode=2,
>   61.
>           pre_char=-1, table=0x0, get_info=0) at ./../src/read.c:5276
>   62.
>       #18 0x00000000005445fe in _internal_read (port=0x7f5f3b8a2578,
> stxsrc=0x7f5f3b8a2480, crc=<value optimized out>, cant_fail=<value
> optimized out>, honu_mode=<value optimized out>,
>   63.
>           recur=0, expose_comment=0, extra_char=-1,
> init_readtable=0x0, magic_sym=0x0, magic_val=0x0,
> delay_load_info=0x7f5f3b8a26c0, get_info=0) at ./../src/read.c:2244
>   64.
>       #19 0x0000000000544a7c in scheme_internal_read_k () at
> ./../src/read.c:2318
>   65.
>       #20 0x0000000000478286 in scheme_top_level_do_worker (k=0x5449b0
> <scheme_internal_read_k>, eb=<value optimized out>, new_thread=0,
> dyn_state=0x0) at ./../src/fun.c:2078
>   66.
>       #21 0x000000000053c058 in scheme_internal_read
> (port=0x7f5f3bd90a10, stxsrc=0x7f5f3bd8f960, crc=<value optimized
> out>, cantfail=0, honu_mode=<value optimized out>, recur=0,
>   67.
>           expose_comment=0, pre_char=<value optimized out>,
> init_readtable=0x0, magic_sym=0x0, magic_val=0x0,
> delay_load_info=0x7f5f3bd8f830) at ./../src/read.c:2352
>   68.
>       #22 0x00000000005224ba in do_load_handler (data=<value optimized
> out>) at ./../src/portfun.c:4050
>   69.
>       #23 0x000000000046f751 in scheme_dynamic_wind (pre=0,
> act=0x522350 <do_load_handler>, post=0x522180 <post_load_handler>,
> jmp_handler=0, data=0x7f5f3b8a26e0) at ./../src/fun.c:7688
>   70.
>       #24 0x0000000000521f43 in default_load (argc=<value optimized
> out>, argv=0x7f5f3ba1ddb0) at ./../src/portfun.c:4282
>   71.
>       #25 0x00007f5f3c7bc6f8 in ?? ()
>   72.
>       #26 0x00007fff447bcf58 in ?? ()
>   73.
>       #27 0x00007fff447bcf18 in ?? ()
>   74.
>       #28 0x0000000000000009 in ?? ()
>   75.
>       #29 0x00007f5f3ba1de78 in ?? ()
>   76.
>       #30 0x00007f5f3bd277f8 in ?? ()
>   77.
>       #31 0x00007f5f3ba1ddd0 in ?? ()
>   78.
>       #32 0x00007fff447bcfb0 in ?? ()
>   79.
>       #33 0x00007f5f3c5e9700 in ?? ()
>   80.
>       #34 0x00007fff447bd010 in ?? ()
>   81.
>       #35 0x00007f5f3c5df203 in ?? ()
>   82.
>       #36 0x00007fff447bcf98 in ?? ()
>   83.
>       ---Type <return> to continue, or q <return> to quit---
>
>   



Posted on the dev mailing list.