[racket-dev] crash running raco setup with racket 6.1

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Oct 23 11:55:23 EDT 2014

I can confirm the crash with a Cairo 1.14 build on 64-bit Mac OS X.
I've submitted a bug report for Cairo (Bug 85372).


For the record, here's how I assembled the report:

The crash happened for me when building the "plot" documentation. By
successively pruning the document's source, I whittled the crashing
expression down to just

 (plot3d (surface3d (λ (x y) (* (cos x) (sin y)))
                    (- pi) pi (- pi) pi))

Next, I put the generated picture in "datum" form via `plot3d/dc` and
`record-dc%`. That gave me a 35k-line S-expression that corresponds to
drawing commands. I performed a binary search on that sequence to find
a small segment that still causes a crash. I end up with

 #lang racket
 (require racket/draw)

 (define W 242) ; size must be big enough to trigger the crash
 (define H 242)
 ; must use the bitmap (non-platform-specific) back-end:
 (define dc (send (make-bitmap W H) make-dc))

 (define picture
   '((set-smoothing smoothed)
     (do-set-pen! ((0 0 0 1.0) 1/3 solid round round #f))
     (draw-lines
      ((94.49384481799765 . 241.40423862491832)
       (97.92538321881572 . 237.25698103165843)
       (103.86884481799765 . 235.02180530906503)
       (100.43730641717958 . 239.0632764810762)
       (94.49384481799765 . 241.40423862491832))
      0.0
      0.0)))

 ((recorded-datum->procedure picture) dc)

To make a Cairo bug report easier to assemble, I instrumented the Cairo
FFI library to log all calls. There were 30 or so calls, many of which
I could tell were redundant or irrelevant. I produced this C program
that crashes with a C-level stack trace like the original one:

 #include <cairo/cairo.h>

 int main () {
   cairo_t *cr;

   cr = cairo_create(cairo_image_surface_create(0, 242, 242));

   cairo_set_antialias(cr, 2);
   cairo_set_line_width(cr, 1.0/3.0);

   cairo_new_path(cr);
   cairo_move_to(cr, 94.49384481799765, 241.40423862491832);
   cairo_line_to(cr, 97.92538321881572, 237.25698103165843);
   cairo_line_to(cr, 103.86884481799765, 235.02180530906503);
   cairo_line_to(cr, 100.43730641717958, 239.0632764810762);
   cairo_line_to(cr, 94.49384481799765, 241.40423862491832);
   cairo_stroke(cr);
 }

I'm pretty sure that program shouldn't crash, and it doesn't crash for
me with Cairo 1.12.

I've spelled out my strategy above in the hope that someone else will
be able to file a Cairo bug report the next time there's a similar
problem. :)

At Thu, 23 Oct 2014 12:46:55 +0200, David Bremner wrote:
> David Bremner <david at tethera.net> writes:
> >
> > As a point of information, I can duplicate the crash with yesterdays
> > snapshot (20141022-d9f2a84).  I didn't bother getting a backtrace there,
> > but I can if it would help.
> 
> I verified that the version of libcairo2 is what makes a difference.
> Installing Debian version 1.12.16-5 made the racket build work again
> both for 6.1 and for the snapshot. Alas that's not going to be a
> feasible strategy for the official Debian builds.
> 
> d
> 
> _________________________
>   Racket Developers list:
>   http://lists.racket-lang.org/dev


Posted on the dev mailing list.