[racket] FFI crashing Racket
The fault occurs as the statement on this line is executed:
https://github.com/plt/racket/blob/43d6684ab9468a2d4d8154fb9ec01cf58ce95d90/racket/src/racket/src/thread.c#L1456
It happens with racket3m compiled from master (-O0) but not with
racketcgc.
gdb output:
(gdb) handle SIGSEGV nostop noprint
Signal Stop Print Pass to program Description
SIGSEGV No No Yes Segmentation fault
(gdb) run
Starting program: /home/m4burns/racket/racket/src/build/racket/racket3m /home/m4burns/cows/foo.rkt
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7ffff631f700 (LWP 29435)]
#<cpointer:CXIndex>
Program received signal SIGABRT, Aborted.
0x00007ffff713e967 in raise () from /usr/lib/libc.so.6
(gdb) bt
#0 0x00007ffff713e967 in raise () from /usr/lib/libc.so.6
#1 0x00007ffff713fd3a in abort () from /usr/lib/libc.so.6
#2 0x00000000007887ef in fault_handler (sn=11, si=0xacb5b0, ctx=0xacb480) at ../../../racket/gc2/sighand.c:99
#3 <signal handler called>
#4 0x00000000007326ec in scheme_do_close_managed (m=0x7fffee2e0c48, cf=0x7332d2 <scheme_run_atexit_closers>) at ../../../racket/gc2/../src/thread.c:1456
#5 0x00000000007334d5 in scheme_run_atexit_closers_on_all (alt=0x0) at ../../../racket/gc2/../src/thread.c:1825
#6 0x0000000000733513 in do_run_atexit_closers_on_all () at ../../../racket/gc2/../src/thread.c:1830
#7 0x00007ffff7141272 in __run_exit_handlers () from /usr/lib/libc.so.6
#8 0x00007ffff71412c5 in exit () from /usr/lib/libc.so.6
#9 0x0000000000447b2c in scheme_immediate_exit (status=0) at ../../../racket/gc2/../src/error.c:3402
#10 0x000000000042b88a in main_after_stack (data=0x7fffffffde30) at ../../../racket/gc2/../main.c:451
#11 0x000000000042bbc6 in do_main_stack_setup (no_auto_statics=1, _main=0x42b79d <main_after_stack>, data=0x7fffffffde30) at ../../../racket/gc2/../src/salloc.c:198
#12 0x000000000042bc26 in scheme_main_stack_setup (no_auto_statics=1, _main=0x42b79d <main_after_stack>, data=0x7fffffffde30) at ../../../racket/gc2/../src/salloc.c:310
#13 0x000000000042b79b in main_after_dlls (argc=2, argv=0x7fffffffdf48) at ../../../racket/gc2/../main.c:381
#14 0x000000000042b766 in main (argc=2, argv=0x7fffffffdf48) at ../../../racket/gc2/../main.c:341
(gdb)
On Thu, Oct 16, 2014 at 12:12:05PM -0400, Marc Burns wrote:
> I was able to reproduce with Racket 6.1 (release) but not Racket
> 6.0.1.11 (git). The crash happens for LLVM 3.4 and 3.5 at least.
>
> On Thu, Oct 16, 2014 at 09:40:00PM +0700, Evgeny Odegov wrote:
> > I didn't know about things explained in the message by link
> > http://lists.racket-lang.org/dev/archive/2014-March/013984.html .
> > So, I've made tests again:
> >
> > user$ gdb -q --args racket clang_ffi_crash.rkt
> > Reading symbols from /usr/bin/racket...(no debugging symbols found)...done.
> > (gdb) handle SIGSEGV nostop noprint
> > Signal Stop Print Pass to program Description
> > SIGSEGV No No Yes Segmentation fault
> > (gdb) run
> > Starting program: /usr/bin/racket clang_ffi_crash.rkt
> > [Thread debugging using libthread_db enabled]
> > Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
> > [New Thread 0xb74c3b40 (LWP 15455)]
> > 138124288
> > [Thread 0xb74c3b40 (LWP 15455) exited]
> > [Inferior 1 (process 15452) exited normally]
> >
> >
> > user$ gdb -q --args racket --eval "(require (file
> > \"/home/user/clang_ffi_crash.rkt\"))"
> > Reading symbols from /usr/bin/racket...(no debugging symbols found)...done.
> > (gdb) handle SIGSEGV nostop noprint
> > Signal Stop Print Pass to program Description
> > SIGSEGV No No Yes Segmentation fault
> > (gdb) run
> > Starting program: /usr/bin/racket --eval \(require\ \(file\
> > \"/home/user/clang_ffi_crash.rkt\"\)\)
> > [Thread debugging using libthread_db enabled]
> > Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
> > [New Thread 0xb74c3b40 (LWP 15150)]
> >
> > Program received signal SIGABRT, Aborted.
> > 0x00132416 in __kernel_vsyscall ()
> > (gdb) backtrace
> > #0 0x00132416 in __kernel_vsyscall ()
> > #1 0x001b3e0f in __GI_raise (sig=6)
> > at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
> > #2 0x001b7455 in __GI_abort () at abort.c:91
> > #3 0x0829233d in fault_handler ()
> > #4 <signal handler called>
> > #5 0x081f7ea6 in scheme_load_delayed_code ()
> > #6 0x0809451f in scheme_delay_load_closure ()
> > #7 0x080d4291 in ?? ()
> > #8 0x080e423a in scheme_on_demand_with_args ()
> > #9 0x080e4267 in scheme_on_demand ()
> > #10 0x0033088e in ?? ()
> > #11 0x0809a630 in scheme_do_eval ()
> > #12 0x080b8c78 in ?? ()
> > #13 0x0033fada in ?? ()
> > #14 0x0809a630 in scheme_do_eval ()
> > #15 0x0813be14 in ?? ()
> > #16 0x08098fb6 in scheme_do_eval ()
> > #17 0x080bddc8 in scheme_finish_apply_for_prompt ()
> > #18 0x080bdfb9 in scheme_apply_for_prompt ()
> > #19 0x080c382e in ?? ()
> > #20 0x0809a1e9 in scheme_do_eval ()
> > #21 0x080b6f7d in ?? ()
> > ---Type <return> to continue, or q <return> to quit---
> > #22 0x08145857 in scheme_module_run_finish ()
> > #23 0x0032e085 in ?? ()
> > #24 0x08129718 in scheme_module_run_start ()
> > #25 0x08148236 in ?? ()
> > #26 0x0814831b in ?? ()
> > #27 0x08148988 in ?? ()
> > #28 0x08152f57 in ?? ()
> > #29 0x08154a98 in ?? ()
> > #30 0x081628d5 in scheme_top_level_require_execute ()
> > #31 0x0809a05a in scheme_do_eval ()
> > #32 0x0809be5c in ?? ()
> > #33 0x0809c1d9 in _scheme_eval_compiled_multi ()
> > #34 0x08099376 in scheme_do_eval ()
> > #35 0x080be158 in scheme_finish_apply_for_prompt ()
> > #36 0x080be349 in scheme_apply_for_prompt ()
> > #37 0x080c3c2e in ?? ()
> > #38 0x0809a5a9 in scheme_do_eval ()
> > #39 0x080ad438 in ?? ()
> > #40 0x080b64b3 in scheme_top_level_do_worker ()
> > #41 0x080b66f7 in scheme_top_level_do ()
> > #42 0x080b7349 in ?? ()
> > #43 0x08094ba2 in scheme_eval_multi_with_prompt ()
> > #44 0x0809c558 in ?? ()
> > ---Type <return> to continue, or q <return> to quit---
> > #45 0x08072c37 in _start ()
> >
> >
> > Is it a problem with --eval version, or maybe I do something wrong?
> >
> > ____________________
> > Racket Users list:
> > http://lists.racket-lang.org/users
> >
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
>