[racket-dev] seeing segfaults on build on 64-bit ubuntu

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Jul 30 10:29:29 EDT 2012

Thanks! Inspired by this information, I've managed to produce a
consistent crash on my machine by attempting to render the "plot"
documentation concurrently in three places.

My guess is that it's a thread-safety problem in Cairo. That is, Cairo
is supposed to be thread-safe, but maybe we're tripping over some
synchronization bug in Cairo.

I changed the `racket/draw' Cairo binding to force all uses of Cairo
through Racket's initial place, and then rendering consistently
succeeds on my machine. This change reduces the potential for
parallelism when using `racket/draw', and also slows drawing in any
place other than the initial place (so that the "plot" document, for
example, takes 77 seconds instead of 42 seconds to render). But if the
change solves the problem, then I don't see a good alternative. Also,
`racket/draw' already synchronizes all calls into Pango (which handles
font and glyph operations for `racket/draw' and does not claim to be
thread-safe).

I've pushed the change to the git repo's master branch. Please let me
know whether a build on your machine works with this change.

At Sun, 29 Jul 2012 12:40:07 -0400, Danny Yoo wrote:
> I tried building from scratch again from
> c9d0319a11cb2aae6d1e81d0c6465b4241a4ecff  and see the following:
> 
> 
> raco setup: 1 running: plot/scribblings/plot.scrbl
> raco setup: 2 running: preprocessor/scribblings/preprocessor.scrbl
> raco setup: 2 running: scribblings/quick/quick.scrbl
> raco setup: 2 running: r5rs/r5rs.scrbl
> raco setup: 2 running: r6rs/scribblings/r6rs.scrbl
> *** glibc detected *** racket/racket3m: double free or corruption
> (!prev): 0x00002afccc1395e0 ***
> *** glibc detected *** racket/racket3m: double free or corruption
> (!prev): 0x00002afccc1395e0 ***
> ======= Backtrace: =========
> ======= Backtrace: =========
> /lib/x86_64-linux-gnu/libc.so.6(+0x7e626)[0x2afca64ad626]
> /usr/lib/x86_64-linux-gnu/libpixman-1.so.0(pixman_image_unref+0x17)[0x2afce1314a
> 97]
> /usr/lib/x86_64-linux-gnu/libcairo.so.2(+0x21fd1)/usr/lib/x86_64-linux-gnu/libca
> iro.so.2(+0x293cc/usr/lib/x86_64-linux-gnu/libcairo.so.2(cairo_stroke_preserve+0
> x20)[0x2afce102e250]
> /usr/lib/x86_64-linux-gnu/libcairo.so.2(cairo_stroke+0x9)[0x2afce102e269]
> racket/racket3m(/usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call+0x1e5)[0x2afca600
> f435]
> racket/racket3m(scheme_do_eval+0x295)[0x454bd5]
> racket/racket3m(ffi_do_call+0x70b)[0x6485eb]
> racket/racket3m(scheme_do_eval+0x295)[0xAborted (core dumped)
> make[1]: *** [install-3m] Error 134
> make[1]: Leaving directory `/home/dyoo/local/racket/src/build'
> make: *** [install] Error 2
> 
> 
> 
> dyoo at grom:~/local/racket/src/build$ gdb racket/racket3m core
> GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2) 7.4-2012.04
> Copyright (C) 2012 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-linux-gnu".
> For bug reporting instructions, please see:
> <http://bugs.launchpad.net/gdb-linaro/>...
> Reading symbols from /home/dyoo/local/racket/src/build/racket/racket3m...done.
> 
> warning: core file may not match specified executable file.
> [New LWP 8450]
> [New LWP 6091]
> [New LWP 6090]
> [New LWP 8455]
> [New LWP 6092]
> [New LWP 8454]
> [New LWP 8448]
> [New LWP 8453]
> [New LWP 8449]
> [New LWP 8451]
> [New LWP 8452]
> 
> warning: Can't read pathname for load map: Input/output error.
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
> Core was generated by `racket/racket3m -X
> /home/dyoo/local/racket/collects -N raco setup -l- setup --n'.
> Program terminated with signal 6, Aborted.
> #0  0x00002afca6465445 in raise () from /lib/x86_64-linux-gnu/libc.so.6
> (gdb) where
> #0  0x00002afca6465445 in raise () from /lib/x86_64-linux-gnu/libc.so.6
> #1  0x00002afca6468bab in abort () from /lib/x86_64-linux-gnu/libc.so.6
> #2  0x00002afca64a2e2e in ?? () from /lib/x86_64-linux-gnu/libc.so.6
> #3  0x00002afca64ad626 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
> #4  0x00002afce1314a97 in pixman_image_unref ()
>    from /usr/lib/x86_64-linux-gnu/libpixman-1.so.0
> #5  0x00002afce103c965 in ?? () from /usr/lib/x86_64-linux-gnu/libcairo.so.2
> #6  0x00002afce103e3cc in ?? () from /usr/lib/x86_64-linux-gnu/libcairo.so.2
> #7  0x00002afce103f6eb in ?? () from /usr/lib/x86_64-linux-gnu/libcairo.so.2
> #8  0x00002afce103fe8b in ?? () from /usr/lib/x86_64-linux-gnu/libcairo.so.2
> #9  0x00002afce105d642 in ?? () from /usr/lib/x86_64-linux-gnu/libcairo.so.2
> #10 0x00002afce1036fd1 in ?? () from /usr/lib/x86_64-linux-gnu/libcairo.so.2
> #11 0x00002afce102e250 in cairo_stroke_preserve ()
>    from /usr/lib/x86_64-linux-gnu/libcairo.so.2
> #12 0x00002afce102e269 in cairo_stroke ()
>    from /usr/lib/x86_64-linux-gnu/libcairo.so.2
> #13 0x00002afca600fa14 in ffi_call_unix64 ()
>    from /usr/lib/x86_64-linux-gnu/libffi.so.6
> #14 0x00002afca600f435 in ffi_call ()
>    from /usr/lib/x86_64-linux-gnu/libffi.so.6
> #15 0x00000000006485eb in ffi_do_call (data=<optimized out>,
>     argc=<optimized out>, argv=0x2afcddc01998) at xsrc/foreign.c:5246
> #16 0x0000000000454bd5 in scheme_do_eval (obj=0x2afd28d11328, num_rands=1,
>     rands=0x2afcddc01998, get_value=-1)
>     at ../../../racket/gc2/../src/eval.c:2991
> #17 0x0000000000458603 in _scheme_apply_multi_from_native (
>     rator=<optimized out>, argc=1, argv=<optimized out>)
>     at ../../../racket/gc2/../src/schnapp.inc:87
> #18 0x00002afca87502fb in ?? ()
> #19 0x00002afcbe3260f0 in ?? ()
> #20 0x00002afcd7e34aa2 in ?? ()
> #21 0x0000000000000000 in ?? ()

Posted on the dev mailing list.