[racket-dev] calling make-keyword-procedure from inside a thread produces a stack overflow in scheme_uncopy_stack

From: Matthew Eric Bassett (mebassett at gegn.net)
Date: Wed May 15 08:40:04 EDT 2013

This is related to 
http://www.mail-archive.com/users@racket-lang.org/msg17597.html. Forgive 
me for posting it again, I wanted to make sure it didn't disappear into 
a black hole.

Launching a racket thread that calls make-keyword-procedure may produce 
a seg fault.  For instance,

(let loop () (thread (make-keyword-procedure (lambda (x y) '()))) 
(loop))

Reliably causes a seg fault.  Repeatedly calling

(thread (make-keyword-procedure (lambda (x y) '())))

will eventually (but not consistently) produce a seg fault.  Functions 
defined with make-keyword-procedure, such as const and thunk* suffer the 
same fate (plain ol' thunk is fine).

A coredump of the racket repl from this segfault shows a stack overflow 
in scheme_uncopy_stack, with the Scheme_Jumpup_Buf zeroed out.  Please 
see our gdp session at http://pastebin.com/aBx2FTcK (This is from racket 
compiled without optimization)  or cause your own seg fault with the 
above code.

Perhaps we're being incredibly daft to write code where we'd need to 
const or thunk* something inside a thread, or perhaps this is a bug in 
racket.  We might just be incredibly daft by calling a const inside a 
thread, or this is a bug in racket, or something else is up.  In any 
case, we've exhausted our abilities to investigate it further and would 
appreciate advice from those more familiar with the code.

Regards,

--
Matthew Eric Bassett | http://mebassett.info

Posted on the dev mailing list.