[racket-dev] memory consumption (bug?) on Debian/kFreeBSD-i386

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon May 9 08:56:48 EDT 2011

Maybe someone decided that SIGSEGV is the right signal after all for an
mprotect() violation (which Rackets catches as a write barrier) instead
of SIGBUS.

In "src/racket/gc2/sighand.c" around line 137:

#  if defined(__FreeBSD__) && (__FreeBSD_version < 700000)
#    define USE_SIGACTON_SIGNAL_KIND SIGBUS
#  else
#    define USE_SIGACTON_SIGNAL_KIND SIGSEGV
#  endif

try dropping the "defined(__FreeBSD__) &&".

At Mon, 09 May 2011 09:09:18 -0300, David Bremner wrote:
> On Fri, 29 Apr 2011 08:46:32 -0600, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> > I've pushed fixes for kFreeBSD, so let me know if you encounter further
> > problems.
> 
> It seems the updates (gcc?) on kFreeBSD (i386 and amd64) cause a
> regression: I am getting a segmentation fault from "make gracket3m" with
> current git master.  I also got the same segmentation fault in an old
> version of the code (5.1.1+the previous kFreeBSD patches), where both
> versions compiled fine before this upgrade.
> 
> I attach the stack trace. If it helps, this is with gcc 4.6.1.
> 
> #0  scheme_gmp_tls_unload (s=0x8019c9930, data=0x0) at ./gmp/gmp.c:5813
> #1  0x00000000005db0fe in done_with_GC () at ./../src/thread.c:7591
> #2  0x000000000060fb16 in garbage_collect (gc=<value optimized out>, 
>     force_full=<value optimized out>, switching_master=<value optimized out>, 
>     lmi=<value optimized out>) at ./newgc.c:4433
> #3  0x0000000000613aaa in allocate_slowpath (s=<value optimized out>) at 
> ./newgc.c:1182
> #4  allocate (s=<value optimized out>) at ./newgc.c:1220
> #5  allocate (s=<value optimized out>) at ./newgc.c:1328
> #6  GC_malloc_one_tagged (s=<value optimized out>) at ./newgc.c:1328
> #7  0x0000000000613dd4 in GC_malloc_pair (car=<value optimized out>, 
>     cdr=<value optimized out>) at ./newgc.c:1292
> #8  0x00000000004f0a45 in do_add_simple_require_renames (rn=0x8019ca720, 
>     required=0x8019ca690, orig_src=0x8019ca790, im=0x8019c8a08, pt=0x8019ca5b8, 
>     idx=0x8019c8580, marshal_phase_index=0x1, src_phase_index=0x1, 
> can_override=1)
>     at ./../src/module.c:2401
> #9  0x00000000004f0d70 in add_simple_require_renames (orig_src=0x8019ca790, 
>     rn_set=0x8019ca820, tables=0x8019ca7d0, im=0x8019c8a08, idx=0x8019c8580, 
>     import_shift=0x1, can_override=1, only_export_phase=0x0) at 
> ./../src/module.c:2458
> #10 0x0000000000501bbc in do_module_begin (form=0x8019caa88, env=0x8019ca920, 
>     rec=0x7fffffffb630, drec=0) at ./../src/module.c:6185
> #11 0x0000000000627c46 in scheme_compile_expand_expr (form=0x8019caa88, 
> env=0x8019ca920, 
>     rec=0x7fffffffb630, drec=<value optimized out>, app_position=0)
>     at ./../src/compile.c:4159
> #12 0x00000000004fa9f3 in do_module (form=0x8019cae98, env=0x8019cab08, 
>     rec=0x7fffffffb630, drec=0) at ./../src/module.c:5665
> #13 0x0000000000627c46 in scheme_compile_expand_expr (form=0x8019cae98, 
> env=0x8019cab08, 
>     rec=0x7fffffffb630, drec=<value optimized out>, app_position=0)
>     at ./../src/compile.c:4159
> #14 0x0000000000443552 in compile_k () at ./../src/eval.c:3683
> #15 0x0000000000465faa in scheme_top_level_do_worker (k=0x442fc0 <compile_k>, 
>     eb=<value optimized out>, new_thread=0, dyn_state=0x0) at 
> ./../src/fun.c:1123
> #16 0x00000000004492b4 in scheme_default_compile_handler (argc=<value optimized 
> out>, 
>     argv=0x7fffffffbd10) at ./../src/eval.c:4273
> #17 0x000000000044da19 in scheme_do_eval (obj=0x930610, num_rands=2, 
>     rands=0x7fffffffbd10, get_value=1) at ./../src/eval.c:2351
> #18 0x000000000045e1de in apply_k () at ./../src/fun.c:1284
> #19 0x0000000000465faa in scheme_top_level_do_worker (k=0x45e150 <apply_k>, 
>     eb=<value optimized out>, new_thread=0, dyn_state=0x0) at 
> ./../src/fun.c:1123
> #20 0x0000000000442d94 in call_compile_handler (form=<value optimized out>, 
>     immediate_eval=<value optimized out>) at ./../src/eval.c:3537
> #21 0x0000000000443a50 in compile_k () at ./../src/eval.c:3669
> #22 0x0000000000465faa in scheme_top_level_do_worker (k=0x442fc0 <compile_k>, 
>     eb=<value optimized out>, new_thread=0, dyn_state=0x0) at 
> ./../src/fun.c:1123
> #23 0x000000000044f413 in scheme_default_eval_handler (argc=<value optimized 
> out>, 
>     argv=0x8019cebb0) at ./../src/eval.c:4260
> #24 0x000000000044da19 in scheme_do_eval (obj=0x9305d0, num_rands=1, 
> rands=0x8019cebb0, 
>     get_value=-1) at ./../src/eval.c:2351
> #25 0x000000000044bf83 in scheme_do_eval (obj=0x8019cb040, num_rands=0, 
> rands=0x0, 
>     get_value=-1) at ./../src/eval.c:2764
> #26 0x000000000046d014 in scheme_finish_apply_for_prompt (prompt=0x0, 
>     _prompt_tag=<value optimized out>, proc=0x8019cb040, argc=0, argv=0x0)
>     at ./../src/fun.c:5481
> #27 0x000000000046d233 in scheme_apply_for_prompt (prompt=<value optimized 
> out>, 
>     prompt_tag=<value optimized out>, proc=<value optimized out>, 
>     argc=<value optimized out>, argv=<value optimized out>) at 
> ./../src/fun.c:5560
> #28 0x0000000000472711 in call_with_prompt (in_argc=<value optimized out>, 
>     in_argv=0x7fffffffc8f0) at ./../src/fun.c:5885
> #29 0x000000000044da19 in scheme_do_eval (obj=0x91f9a0, num_rands=3, 
>     rands=0x7fffffffc8f0, get_value=-1) at ./../src/eval.c:2351
> #30 0x0000000000467002 in do_call_with_prompt (f=<value optimized out>, 
>     data=<value optimized out>, multi=1, top_level=0) at ./../src/fun.c:6077
> #31 0x000000000046d3d5 in do_apply_with_prompt (rator=0x9305d0, num_rands=1, 
>     rands=0x7fffffffcaa8, multi=1, top_level=0) at ./../src/fun.c:1403
> #32 0x000000000055272e in do_load_handler (data=<value optimized out>)
>     at ./../src/portfun.c:4284
> #33 0x000000000046fce1 in scheme_dynamic_wind (pre=0, act=0x552430 
> <do_load_handler>, 
>     post=0x54ecc0 <post_load_handler>, jmp_handler=0, data=0x8019cb2b0)
>     at ./../src/fun.c:7743
> #34 0x0000000000552367 in default_load (argc=<value optimized out>, 
> argv=0x8019a9db8)
>     at ./../src/portfun.c:4400
> #35 0x0000000800aa19aa in ?? ()
> #36 0x00007fffffffcd80 in ?? ()
> #37 0x00000008019a9ea0 in ?? ()
> #38 0x0000000000000005 in ?? ()
> #39 0x00000008015771a8 in ?? ()
> #40 0x00000000ffffffff in ?? ()
> #41 0x0000000000000000 in ?? ()


Posted on the dev mailing list.