Summary

segfault violation with thread-sleep! on a flonums

Metadata

Description

When I run thread-sleep! under certain conditions, I get a segfault. I think this is a bug.

 1944 klm@kth ~/p/e/c/tests  ➤ cat thread-sleep-segfault.scm 
 (import srfi-18)
 
 (thread-start!
  (lambda () (thread-sleep! 2.1)))
 1944 klm@kth ~/p/e/c/tests  ➤ csi5 -s thread-sleep-segfault.scm # works
 1946 klm@kth ~/p/e/c/tests  ➤ csc5 thread-sleep-segfault.scm 
 1947 klm@kth ~/p/e/c/tests  ➤ ./thread-sleep-segfault # works
 1944 klm@kth ~/p/e/c/tests  ➤ csi5 thread-sleep-segfault.scm # fails
 CHICKEN
 (c) 2008-2018, The CHICKEN Team
 (c) 2000-2007, Felix L. Winkelmann
 Version 5.0.0 (rev 4e1f1a7c)
 linux-unix-gnu-x86-64 [ 64bit dload ptables ]
 
 ; loading thread-sleep-segfault.scm ...
 ; loading /home/klm/.chickens/master/lib/chicken5/9/srfi-18.import.so ...
 ; loading /home/klm/.chickens/master/lib/chicken5/9/chicken.flonum.import.so ...
 ; loading /home/klm/.chickens/master/lib/chicken5/9/srfi-18.so ...
 #;1> 
 Warning (#<thread: thread351>): in thread: segmentation violation
 
 	Call history:
 
 	<eval>	  (thread-sleep! 2.1)	<--

I've tried various values for thread-sleep!:

- fixnums seem to work ok - some rational numbers seem to work - I don't think any inexact numbers work - 0.5 does not work - 1/2 works! - 1/3 does not work

If I add '(thread-sleep! 3)' at the end of the file, everything seems to work again. Maybe the `repl` is causing this?

Changes and comments

[2018-04-30 20:14:56 UTC] kristianlm wrote:

I discovered that if you change the file to look like this:

 2013 klm@kth ~/p/e/c/tests  ➤ cat thread-sleep-segfault.scm 
 (import srfi-18 (only (chicken repl) repl))
 (thread-start!
  (lambda () (thread-sleep! 0.3)))
 (repl)

Then the segfault appears in all cases (csi -s, csi, csc).

[2018-04-30 21:43:56 UTC] kooda changed status from new to closed

[2018-04-30 21:43:56 UTC] kooda set resolution to fixed

[2018-04-30 21:43:56 UTC] kooda wrote:

Fixed in 580d44f6c885872fe446ea263385b1fcd75eed5b