[Haskell-beginners] Segmentation fault

Michael Peternell michael.peternell at gmx.at
Sun Apr 28 23:47:55 CEST 2013


which bug report says XCode 4.1? I posted 3 bug reports, and only one references XCode:
http://hackage.haskell.org/trac/ghc/ticket/7212
and it says XCode 4.0.2.

furthermore, the bug report has the status "wontfix" which means that it hasn't been fixed. so the bug will persist for all future versions of xcode and for all future versions of ghc until it is fixed. which probably means that ghc is not really usable on the mac platform, right now.

i only used the 64-bit version of haskell.

the bug shows up at a particular stage during the GC-cycle. that doesn't have to mean that the bug is in the GC-code. it is also possible that there is some initialization function that hasn't been called, like initAllocForGMP():

   WARNING!! WARNING!! WARNING!!

     It is absolutely vital that this initialisation function be called before
     any of the gmp functions are called. We'd still be looking back a couple
     words for the ByteArray# header, but if we were accidentally using malloc
     then it'd all go wrong because of course there would be no ByteArray#
     header, just malloc's own internal book keeping info. To make things worse
     we would not notice immediately, it'd only be when the GC comes round to
     inspect things... BANG!

     > Program received signal SIGSEGV, Segmentation fault.
     > [Switching to Thread 0x7f5a9ebc76f0 (LWP 17838)]
     > evacuate1 (p=0x7f5a99acd2e0) at rts/sm/Evac.c:375
     > 375       switch (info->type) {

*** snip

initAllocForGMP() is most likely not the problem, because it most likely gets called (it is defined as a "constructor" function). i just wanted to illustrate the point that the bug can be anywhere. And as a haskell beginner I think I'm not the right person to track it down. I don't even know how to build ghc with debug symbols enabled ;)

Am 28.04.2013 um 15:59 schrieb Hollister Herhold:

> 
> The bug report says XCode 4.1 or higher. Hmm.
> 
> Have you tried the 32-bit version of the Haskell Platform?
> 
> 
> On Apr 28, 2013, at 3:56 AM, Michael Peternell wrote:
> 
>> Hi,
>> 
>> My XCode version is 4.2 Build 4C199.
>> 
>> I doubt that it is a hardware issue, because:
>> 1) only ghci crashes
>> 2) when ghci crashes, it always crashes exactly at the same stage during initialization. (see logs in my previous message)
>> 3) it always crashes because of EXC_BAD_ACCESS in function evacuate1
>> 4) This time, the GDB says "0x00000001c4db959a in evacuate1 ()". Last time it told me "0x00000001b777859a in evacuate1 ()". The addresses are different, so its not a particular bit in physical memory that is broken. And if my RAM were generally broken, then it would crash always at the same position.
>> 
>> I'm 99.999% sure that there is a bug in the garbage collection code somewhere, presumably in evacuate1(). Check out the backtrace...
>> 
>> Program received signal EXC_BAD_ACCESS, Could not access memory.
>> Reason: KERN_INVALID_ADDRESS at address: 0x00000000e327a440
>> 0x00000001e326359a in evacuate1 ()
>> (gdb) bt
>> #0  0x00000001e326359a in evacuate1 ()
>> #1  0x00000001e32691b8 in scavenge_block1 ()
>> Previous frame inner to this frame (gdb could not unwind past this frame)
>> (gdb) 
>> 
>> 
>> Am 28.04.2013 um 08:08 schrieb Kyle Murphy:
>> 
>>> Something else to look into is that this sounds like bad ram to me. Have you run any memory diagnostics and/or checked to see if you're having any HD issues? Anytime you have intermittent crashes like these I tend to suspect hardware issues. Do you have another computer with the same OS version you could try to reproduce the issue on?
>>> 
>>> On Apr 27, 2013 12:13 PM, "Hollister Herhold" <hollister at fafoh.com> wrote:
>>> 
>>> The haskell platform installs to /usr/bin and /Library/Haskell. You can run /usr/bin/uninstall-hs to remove the Haskell Platform. Just running it does nothing - it will tell you what it's going to do and then you have to feed it the appropriate option to make it actually do the uninstall.
>>> 
>>> What's your XCode version?
>>> 
>>> 
>>> On Apr 27, 2013, at 9:15 AM, Michael Peternell wrote:
>>> 
>>>> Hi,
>>>> 
>>>> thanks for you help so far!
>>>> 
>>>> I have OX X Snow Leopard with all software updates installed (I checked this 5min ago). My OSX-Version is 10.6.8 . I have downloaded the 64bit version of GHC.
>>>> 
>>>> hmm, this is strange: i downloaded ghc-7.6.3 from
>>>> http://www.haskell.org/ghc/download_ghc_7_6_3#macosx_x86_64
>>>> i did "./configure" and "sudo make install", but still it seems that I have version 7.4.2. It turns out that one installer installs into /usr/bin and the other into /usr/local/bin.
>>>> 
>>>> michael at MacMichi:~ $ /usr/local/bin/ghci --version
>>>> The Glorious Glasgow Haskell Compilation System, version 7.6.3
>>>> michael at MacMichi:~ $ /usr/bin/ghci --version
>>>> The Glorious Glasgow Haskell Compilation System, version 7.4.2
>>>> michael at MacMichi:~ $ ghci --version
>>>> The Glorious Glasgow Haskell Compilation System, version 7.4.2
>>>> michael at MacMichi:~ $ which ghci
>>>> /usr/bin/ghci
>>>> 
>>>> version 7.6.3 still crashes occasionally:
>>>> 
>>>> michael at MacMichi:~ $ /usr/local/bin/ghci
>>>> GHCi, version 7.6.3: http://www.haskell.org/ghc/  :? for help
>>>> Loading package ghc-prim ... linking ... done.
>>>> Loading package integer-gmp ... linking ... done.
>>>> Loading package base ... linking ... done.
>>>> Segmentation fault
>>>> 
>>>> Maybe it is really this bug that just needs to be fixed and that won't just disappear on its own?
>>>> http://hackage.haskell.org/trac/ghc/ticket/7212
>>>> http://hackage.haskell.org/trac/ghc/ticket/7403
>>>> 
>>>> DEBUGGING:
>>>> 
>>>> I added an echo line into /usr/local/bin/ghc-7.6.3 so it reads
>>>> 
>>>> #!/bin/sh
>>>> exedir="/usr/local/lib/ghc-7.6.3"
>>>> exeprog="ghc-stage2"
>>>> executablename="$exedir/$exeprog"
>>>> datadir="/usr/local/share"
>>>> bindir="/usr/local/bin"
>>>> topdir="/usr/local/lib/ghc-7.6.3"
>>>> executablename="$exedir/ghc"
>>>> echo "$executablename" -B"$topdir" ${1+"$@"}
>>>> exec "$executablename" -B"$topdir" ${1+"$@"}
>>>> 
>>>> So I have all the ingredients to start GDB.
>>>> 
>>>> +++ BEGIN DEBUG SESSION +++
>>>> 
>>>> michael at MacMichi:~ $ /usr/local/bin/ghci
>>>> /usr/local/lib/ghc-7.6.3/ghc -B/usr/local/lib/ghc-7.6.3 --interactive
>>>> GHCi, version 7.6.3: http://www.haskell.org/ghc/  :? for help
>>>> Loading package ghc-prim ... linking ... done.
>>>> Loading package integer-gmp ... linking ... done.
>>>> Loading package base ... linking ... done.
>>>> Segmentation fault
>>>> michael at MacMichi:~ $ gdb
>>>> GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Mon Aug 15 16:03:10 UTC 2011)
>>>> 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 "x86_64-apple-darwin".
>>>> (gdb) set args -B/usr/local/lib/ghc-7.6.3 --interactive
>>>> (gdb) show args
>>>> Argument list to give program being debugged when it is started is "-B/usr/local/lib/ghc-7.6.3 --interactive".
>>>> (gdb) run
>>>> Starting program:  -B/usr/local/lib/ghc-7.6.3 --interactive
>>>> No executable file specified.
>>>> Use the "file" or "exec-file" command.
>>>> (gdb) exec-file /usr/local/lib/ghc-7.6.3/ghc
>>>> Reading symbols for shared libraries .... done
>>>> (gdb) run
>>>> Starting program: /usr/local/lib/ghc-7.6.3/ghc -B/usr/local/lib/ghc-7.6.3 --interactive
>>>> Reading symbols for shared libraries . done
>>>> Reading symbols for shared libraries warning: Could not find object file "/Users/ian/zz64/ghc-7.6.3/rts/dist/build/libHSrts_thr.a(darwin64.o)" - no debug information available for "/var/folders/9z/yntzqjqn1j95xbpb6dr3qbww0000gn/T//ccr2b8iU.s".
>>>> 
>>>> warning: Could not find object file "/Users/ian/zz64/ghc-7.6.3/rts/dist/build/libHSrts_thr.a(ffi64.o)" - no debug information available for "../src/x86/ffi64.c".
>>>> 
>>>> warning: Could not find object file "/Users/ian/zz64/ghc-7.6.3/rts/dist/build/libHSrts_thr.a(prep_cif.o)" - no debug information available for "../src/prep_cif.c".
>>>> 
>>>> warning: Could not find object file "/Users/ian/zz64/ghc-7.6.3/rts/dist/build/libHSrts_thr.a(types.o)" - no debug information available for "../src/types.c".
>>>> 
>>>> ..... done
>>>> GHCi, version 7.6.3: http://www.haskell.org/ghc/  :? for help
>>>> Loading package ghc-prim ... linking ... done.
>>>> Loading package integer-gmp ... linking ... done.
>>>> Loading package base ... linking ... done.
>>>> 
>>>> Program received signal EXC_BAD_ACCESS, Could not access memory.
>>>> Reason: KERN_INVALID_ADDRESS at address: 0x00000000b778f440
>>>> 0x00000001b777859a in evacuate1 ()
>>>> (gdb)
>>>> 
>>>> +++ END DEBUG SESSION +++
>>>> 
>>>> It doesn't crash every time. If it doesn't crash, I still get some warnings in GDB:
>>>> 
>>>> +++ BEGIN DEBUG SESSION +++
>>>> 
>>>> michael at MacMichi:~ $ gdb
>>>> GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Mon Aug 15 16:03:10 UTC 2011)
>>>> 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 "x86_64-apple-darwin".
>>>> (gdb) exec-file /usr/local/lib/ghc-7.6.3/ghc
>>>> Reading symbols for shared libraries .... done
>>>> (gdb) set args -B/usr/local/lib/ghc-7.6.3 --interactive
>>>> (gdb) run
>>>> Starting program: /usr/local/lib/ghc-7.6.3/ghc -B/usr/local/lib/ghc-7.6.3 --interactive
>>>> Reading symbols for shared libraries . done
>>>> Reading symbols for shared libraries warning: Could not find object file "/Users/ian/zz64/ghc-7.6.3/rts/dist/build/libHSrts_thr.a(darwin64.o)" - no debug information available for "/var/folders/9z/yntzqjqn1j95xbpb6dr3qbww0000gn/T//ccr2b8iU.s".
>>>> 
>>>> warning: Could not find object file "/Users/ian/zz64/ghc-7.6.3/rts/dist/build/libHSrts_thr.a(ffi64.o)" - no debug information available for "../src/x86/ffi64.c".
>>>> 
>>>> warning: Could not find object file "/Users/ian/zz64/ghc-7.6.3/rts/dist/build/libHSrts_thr.a(prep_cif.o)" - no debug information available for "../src/prep_cif.c".
>>>> 
>>>> warning: Could not find object file "/Users/ian/zz64/ghc-7.6.3/rts/dist/build/libHSrts_thr.a(types.o)" - no debug information available for "../src/types.c".
>>>> 
>>>> ..... done
>>>> GHCi, version 7.6.3: http://www.haskell.org/ghc/  :? for help
>>>> Loading package ghc-prim ... linking ... done.
>>>> Loading package integer-gmp ... linking ... done.
>>>> Loading package base ... linking ... done.
>>>> Prelude> takewhile (<200) (let fib a b = a:(fib b (a+b)) in fib 1 1)
>>>> 
>>>> <interactive>:2:1:
>>>>  Not in scope: `takewhile'
>>>>  Perhaps you meant `takeWhile' (imported from Prelude)
>>>> Prelude> takeWhile (<200) (let fib a b = a:(fib b (a+b)) in fib 1 1)
>>>> [1,1,2,3,5,8,13,21,34,55,89,144]
>>>> Prelude>
>>>> 
>>>> +++ END DEBUG SESSION +++
>>>> 
>>>> Greetings to ian!!
>>>> 
>>>> Regards,
>>>> Michael
>>>> 
>>>> Am 27.04.2013 um 15:21 schrieb Hollister Herhold:
>>>> 
>>>>> 
>>>>> Sorry, I wasn't clear - I was thinking OS X 10.8.3. Your uname says 10.8.0, which I now see (after running uname on my 10.7.5 installation, it says darwin 11.4.2) has nothing to do with the version of OS X you're running, so never mind. What version of OS X *are* you running?
>>>>> 
>>>>> The Haskell Platform comes with ghc 7.4.2. The newest release version of ghc is actually 7.6.3, and you can find the binary distributions here:
>>>>> 
>>>>> http://www.haskell.org/ghc/
>>>>> 
>>>>> The Haskell Platform "ships" with an older version that's been "shaken down" a little more than the latest-and-greatest ghc. It also comes with a selection of libraries that have been well-tested. You *can* start with just ghc 7.6.3 and install the libraries yourself, however. I believe the next Haskell Platform release (scheduled for May-ish, I think) will have 7.6.3, but don't quote me on that. Discussions were ongoing last I looked.
>>>>> 
>>>>> I'd suggest downloading and installing the binary for ghc 7.6.3 and see if ghci runs on that without crashing.
>>>>> 
>>>>> Hope this helps.
>>>>> 
>>>>> 
>>>>> On Apr 27, 2013, at 7:56 AM, Michael Peternell wrote:
>>>>> 
>>>>>> Is there a version 10.8.3?
>>>>>> 
>>>>>> I downloaded Haskell from the official website at http://www.haskell.org/platform/ . I followed the one and only "Download" link on the homepage. The Wikipedia says that 7.6.2 is the newest version although I cannot find that version on the haskell website. It's hard for me to believe that the development version would be 3 major version numbers ahead, but maybe we are talking about different implementations?
>>>>>> 
>>>>>> Where can I find the latest version?
>>>>>> 
>>>>>> Regards,
>>>>>> Michael
>>>>>> 
>>>>>> Am 27.04.2013 um 14:12 schrieb Hollister Herhold:
>>>>>> 
>>>>>>> 
>>>>>>> Just a guess, but maybe you could try updating to 10.8.3? I'm pretty sure I've seen people on the ghc-devel mailing list running 10.8.3 and things work. You could also try downloading the ghc 7.6.2 binary.
>>>>>>> 
>>>>>>> 
>>>>>>> On Apr 27, 2013, at 5:59 AM, Michael Peternell wrote:
>>>>>>> 
>>>>>>>> Hey,
>>>>>>>> 
>>>>>>>> i did a little search.
>>>>>>>> 
>>>>>>>> it seems like this was already a bug 3 years ago:
>>>>>>>> http://trac.haskell.org/haskeline/ticket/105
>>>>>>>> and it reappeared on a Mac in version 7.4.1  8 months ago
>>>>>>>> http://hackage.haskell.org/trac/ghc/ticket/7212
>>>>>>>> someone has refiled the bug for 7.4.2
>>>>>>>> http://hackage.haskell.org/trac/ghc/ticket/7403
>>>>>>>> the bug is discussed in communities
>>>>>>>> http://forums.gentoo.org/viewtopic-t-844842-start-0.html
>>>>>>>> 
>>>>>>>> the 7212 ticket is marked as "wontfix" and the 7403-ticket is marked as "duplicate". i don't wanna file another bug report, there are already enough of them.
>>>>>>>> 
>>>>>>>> please, someone fix this bug.
>>>>>>>> 
>>>>>>>> Regards,
>>>>>>>> Michael
>>>>>>>> 
>>>>>>>> Am 27.04.2013 um 12:42 schrieb Michael Peternell:
>>>>>>>> 
>>>>>>>>> Hi,
>>>>>>>>> 
>>>>>>>>> sometimes when I start ghci, I just get a segmentation fault. Sometimes I get even 15 segmentation faults in a row, and sometimes I can open it many times and it works each time.
>>>>>>>>> 
>>>>>>>>> I downloaded the Haskell Platform for Mac, 64Bit, from
>>>>>>>>> http://www.haskell.org/platform/mac.html
>>>>>>>>> I verified the SHA1-Sum, btw.
>>>>>>>>> 
>>>>>>>>> I tried reinstalling the platform, and I tried deleting the ~/.ghc directory, but nothing works. I didn't do anything fancy with Haskell, I just downloaded it yesterday and I didn't tamper with any haskell-files outside of my home-directory. The only kernel extensions I have installed are the ones from VMWare Fusion and maybe flux. (i'm not sure if flux involves kernel extensions or how deeply it messes with the OS.)
>>>>>>>>> 
>>>>>>>>> michael at MacMichi:~ $ rm -rf .ghc
>>>>>>>>> michael at MacMichi:~ $ ghci
>>>>>>>>> GHCi, version 7.4.2: http://www.haskell.org/ghc/  :? for help
>>>>>>>>> Loading package ghc-prim ... linking ... done.
>>>>>>>>> Loading package integer-gmp ... linking ... done.
>>>>>>>>> Loading package base ... linking ... done.
>>>>>>>>> Segmentation fault
>>>>>>>>> michael at MacMichi:~ $ uname -a
>>>>>>>>> Darwin MacMichi.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64
>>>>>>>>> 
>>>>>>>>> michael at MacMichi:~ $ ghci
>>>>>>>>> GHCi, version 7.4.2: http://www.haskell.org/ghc/  :? for help
>>>>>>>>> Loading package ghc-prim ... linking ... done.
>>>>>>>>> Loading package integer-gmp ... linking ... done.
>>>>>>>>> Loading package base ... linking ... done.
>>>>>>>>> Segmentation fault
>>>>>>>>> michael at MacMichi:~ $ ghci
>>>>>>>>> GHCi, version 7.4.2: http://www.haskell.org/ghc/  :? for help
>>>>>>>>> Loading package ghc-prim ... linking ... done.
>>>>>>>>> Loading package integer-gmp ... linking ... done.
>>>>>>>>> Loading package base ... linking ... done.
>>>>>>>>> Prelude> sum (takeWhile (<10000) (filter odd (map (^2) [1..])))
>>>>>>>>> 166650
>>>>>>>>> Prelude>
>>>>>>>>> 
>>>>>>>>> Any insights on what is really going on behind the scenes will be appreciated.
>>>>>>>>> 
>>>>>>>>> Regards,
>>>>>>>>> Michael
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> _______________________________________________
>>>>>>>>> Beginners mailing list
>>>>>>>>> Beginners at haskell.org
>>>>>>>>> http://www.haskell.org/mailman/listinfo/beginners
>>>>>>>> 
>>>>>>>> 
>>>>>>>> _______________________________________________
>>>>>>>> Beginners mailing list
>>>>>>>> Beginners at haskell.org
>>>>>>>> http://www.haskell.org/mailman/listinfo/beginners
>>>>>>> 
>>>>>>> 
>>>>>>> _______________________________________________
>>>>>>> Beginners mailing list
>>>>>>> Beginners at haskell.org
>>>>>>> http://www.haskell.org/mailman/listinfo/beginners
>>>>>> 
>>>>>> 
>>>>>> _______________________________________________
>>>>>> Beginners mailing list
>>>>>> Beginners at haskell.org
>>>>>> http://www.haskell.org/mailman/listinfo/beginners
>>>>> 
>>>>> 
>>>>> _______________________________________________
>>>>> Beginners mailing list
>>>>> Beginners at haskell.org
>>>>> http://www.haskell.org/mailman/listinfo/beginners
>>>> 
>>>> 
>>>> _______________________________________________
>>>> Beginners mailing list
>>>> Beginners at haskell.org
>>>> http://www.haskell.org/mailman/listinfo/beginners
>>> 
>>> 
>>> _______________________________________________
>>> Beginners mailing list
>>> Beginners at haskell.org
>>> http://www.haskell.org/mailman/listinfo/beginners
>>> _______________________________________________
>>> Beginners mailing list
>>> Beginners at haskell.org
>>> http://www.haskell.org/mailman/listinfo/beginners
>> 
>> 
>> _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> http://www.haskell.org/mailman/listinfo/beginners
> 
> 
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners




More information about the Beginners mailing list