Skip to content

Instantly share code, notes, and snippets.

@mlen
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlen/a5863f3861ba8b662264 to your computer and use it in GitHub Desktop.
Save mlen/a5863f3861ba8b662264 to your computer and use it in GitHub Desktop.
Script started on Wed Jan 7 18:45:58 2015
aquila ~ % cat Test.hs
module Main where
import Control.Concurrent
main = do
threadDelay 1000000
putStrLn "hello"
aquila ~ % ghc Test.hs
[1 of 1] Compiling Main ( Test.hs, Test.o )
Linking Test ...
aquila ~ % # run it without pressing ^C
aquila ~ % ./Test
hello
aquila ~ % # press ^C while it sleeps
aquila ~ % ./Test
^C[1] 5285 segmentation fault (core dumped) ./Test
aquila ~ % uname -a
FreeBSD aquila 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014 root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64
aquila ~ % ghc -v
Glasgow Haskell Compiler, Version 7.8.3, stage 2 booted by GHC version 7.6.3
Using binary package database: /usr/local/lib/ghc-7.8.3/package.conf.d/package.cache
wired-in package ghc-prim mapped to ghc-prim-0.3.1.0-954cb57749cf319beafdc89b3415422c
wired-in package integer-gmp mapped to integer-gmp-0.5.1.0-d42e6a7874a019e6a0d1c7305ebc83c4
wired-in package base mapped to base-4.7.0.1-812360bc88c9859b8259f0d90b6e2faa
wired-in package rts mapped to builtin_rts
wired-in package template-haskell mapped to template-haskell-2.9.0.0-209b23d5bd6678f5bc383f0d56742080
wired-in package dph-seq not found.
wired-in package dph-par not found.
Hsc static flags:
*** Deleting temp files:
Deleting:
*** Deleting temp dirs:
Deleting:
ghc: no input files
Usage: For basic information, try the `--help' option.
aquila ~ %
Script done on Wed Jan 7 18:47:02 2015
gdb Test Test.core
GNU gdb (GDB) 7.8.1 [GDB v7.8.1 for FreeBSD]
Copyright (C) 2014 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-portbld-freebsd10.1".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from Test...(no debugging symbols found)...done.
[New process 101190]
[New Thread 802006400 (LWP 101190)]
Core was generated by `Test'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x000000000047ffb7 in generic_handler ()
(gdb) bt
#0 0x000000000047ffb7 in generic_handler ()
#1 0x000000080148a467 in ?? () from /lib/libthr.so.3
#2 0x000000080148a062 in ?? () from /lib/libthr.so.3
#3 <signal handler called>
#4 0x00000008017e5b7a in select () from /lib/libc.so.7
#5 0x0000000801487b32 in select () from /lib/libthr.so.3
#6 0x000000000047fc72 in awaitEvent ()
#7 0x000000000046fc23 in scheduleWaitThread ()
#8 0x0000000000470957 in hs_main ()
#9 0x000000000040645b in main ()
Script started on Thu Jan 8 07:44:08 2015
root@bsd:~ # gdb Test
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...(no debugging symbols found)...
(gdb) r
Starting program: /root/Test
(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...[New LWP 100618]
(no debugging symbols found)...(no debugging symbols found)...[New Thread 802006400 (LWP 100618/Test)]
hello
Program exited normally.
(gdb) r
Starting program: /root/Test
(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...[New LWP 100639]
(no debugging symbols found)...(no debugging symbols found)...[New Thread 802006400 (LWP 100639/Test)]
^C
Program received signal SIGINT, Interrupt.
[Switching to Thread 802006400 (LWP 100639/Test)]
0x00000008017dab7a in select () from /lib/libc.so.7
(gdb) bt
#0 0x00000008017dab7a in select () from /lib/libc.so.7
#1 0x000000080147cb32 in select () from /lib/libthr.so.3
#2 0x0000000000483362 in awaitEvent ()
#3 0x00007fffffffe950 in ?? ()
#4 0x00000008014833c7 in pthread_timedjoin_np () from /lib/libthr.so.3
Previous frame inner to this frame (corrupt stack?)
(gdb) info threads
* 2 Thread 802006400 (LWP 100639/Test) 0x00000008017dab7a in select ()
from /lib/libc.so.7
(gdb) k
Kill the program being debugged? (y or n) y
(gdb) q
root@bsd:~ # exit
Script done on Thu Jan 8 07:45:04 2015
This error is reproducible on fresh FreeBSD 10.1 VM and happens in packaged and
compiled version of GHC, both were booted with GHC 7.6.3.
When a process receives SIGINT, it segfaults.
You can see how stack trace looks in the core dump and from the debugger.
GDB mentions corrupt stack.
This may be caused by GHC or by a bug in a system library.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment