
#10080: Recusive IO actions crash with segmentation fault -------------------------------------+------------------------------------- Reporter: nakal | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: FreeBSD | Architecture: x86_64 Type of failure: Runtime crash | (amd64) Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Description changed by nakal: Old description:
I am learning Haskell and wrote a program that writes some strings to stdout infinitely by recursing in an IO action. It seems such a simple construct crashes on FreeBSD when Ctrl+C is pressed to interrupt it.
I have been able to reduce it to a simple case like this:
{{{#!hs main = do putStrLn "hello world" main }}}
I compiled it with {{{ ghc --make hello.hs }}}
Then pressed Ctrl+C and immediately got: {{{ [...] hello world hello world hello world hello world ^CSegmentation fault (core dumped) }}}
Here is the backtrace of the crash:
{{{ (gdb) bt #0 0x000000000047cdd7 in generic_handler () #1 0x000000080147c467 in swapcontext () from /lib/libthr.so.3 #2 0x000000080147c062 in sigaction () from /lib/libthr.so.3 #3 <signal handler called> #4 0x00000008017d7b7a in select () from /lib/libc.so.7 #5 0x0000000801479b32 in select () from /lib/libthr.so.3 #6 0x000000000043cb13 in fdReady () #7 0x000000000044751c in base_GHCziIOziFD_zdwa3_info () #8 0x0000000000000000 in ?? () }}}
New description: I am learning Haskell and wrote a program that writes some strings to stdout infinitely by recursing in an IO action. It seems such a simple construct crashes on FreeBSD when Ctrl+C is pressed to interrupt it. I have been able to reduce it to a simple case like this: {{{#!hs main = do putStrLn "hello world" main }}} I compiled it with {{{ ghc --make hello.hs }}} Ran it and then pressed Ctrl+C and immediately got: {{{ [...] hello world hello world hello world hello world ^CSegmentation fault (core dumped) }}} Here is the backtrace of the crash: {{{ (gdb) bt #0 0x000000000047cdd7 in generic_handler () #1 0x000000080147c467 in swapcontext () from /lib/libthr.so.3 #2 0x000000080147c062 in sigaction () from /lib/libthr.so.3 #3 <signal handler called> #4 0x00000008017d7b7a in select () from /lib/libc.so.7 #5 0x0000000801479b32 in select () from /lib/libthr.so.3 #6 0x000000000043cb13 in fdReady () #7 0x000000000044751c in base_GHCziIOziFD_zdwa3_info () #8 0x0000000000000000 in ?? () }}} Operating system version is: FreeBSD 10.1-RELEASE-p5 (GENERIC) -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10080#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler