[GHC] #8094: Intermittent segfault when using ghc-7.6.3 -e on OSX 10.6.8

#8094: Intermittent segfault when using ghc-7.6.3 -e on OSX 10.6.8 ----------------------------------+---------------------------------- Reporter: rampion | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Keywords: | Operating System: MacOS X Architecture: x86_64 (amd64) | Type of failure: Runtime crash Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ----------------------------------+---------------------------------- This error was observed using the 64-bit version of ghc-7.6.3 packaged with the Haskell Platform 2013.2.0.0 for OSX. Running commands with `ghc -e` sometimes produces a segfault. {{{ % ghc -e 'return ()' ; echo $? 0 % ghc -e 'return ()' ; echo $? zsh: segmentation fault ghc -e 'return ()' 139 }}} I don't know exactly what's causing it, but I'm suspicious of the binary distributed with the package. When I pull it up in `gdb`, there are warnings pertaining to missing object files expected to be in a `/Users/ian` directory. There's never been an `ian` user on my machine, so I suspect that's an artifact from whomever built the binary. This may also be the root of the intermittent segfault {{{ % cd /Library/Frameworks/GHC.framework/Versions/7.6.3-x86_64/usr/lib/ghc-7.6.3 % gdb ghc GNU gdb 6.3.50-20050815 (Apple version gdb-1518) (Sat Feb 12 02:52:12 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"...Reading symbols for shared libraries .... done 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". (gdb) run -B. -e 'return ()' Starting program: /Library/Frameworks/GHC.framework/Versions/7.6.3-x86_64/usr/lib/ghc-7.6.3/ghc -B. -e 'return ()' Reading symbols for shared libraries + done Program exited normally. (gdb) run -B. -e 'return ()' Starting program: /Library/Frameworks/GHC.framework/Versions/7.6.3-x86_64/usr/lib/ghc-7.6.3/ghc -B. -e 'return ()' Reading symbols for shared libraries + done Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x00000000f34ed440 0x00000001f34d659a in evacuate1 () (gdb) where #0 0x00000001f34d659a in evacuate1 () #1 0x00000001f34dc1b8 in scavenge_block1 () Previous frame inner to this frame (gdb could not unwind past this frame) (gdb) kill Kill the program being debugged? (y or n) y error while killing target (killing anyway): assertion failure on line 300 of "/SourceCache/gdb/gdb-1518/src/gdb/macosx/macosx-nat-inferior-util.c" in function "macosx_inferior_suspend_ptrace": status.value.sig == TARGET_SIGNAL_STOP warning: error on line 2182 of "/SourceCache/gdb/gdb-1518/src/gdb/macosx /macosx-nat-inferior.c" in function "macosx_kill_inferior_safe": (os/kern) failure (0x5x) (gdb) run -B. -e '()' Starting program: /Library/Frameworks/GHC.framework/Versions/7.6.3-x86_64/usr/lib/ghc-7.6.3/ghc -B. -e '()' Reading symbols for shared libraries + done () Program exited normally. (gdb) run -B. -e '()' Starting program: /Library/Frameworks/GHC.framework/Versions/7.6.3-x86_64/usr/lib/ghc-7.6.3/ghc -B. -e '()' Reading symbols for shared libraries + done Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x00000000d1916440 [Switching to process 18462 thread 0x2003] 0x00000001d191bc44 in stg_ap_v_fast () (gdb) where #0 0x00000001d191bc44 in stg_ap_v_fast () #1 0x0000000000000000 in ?? () (gdb) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8094 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8094: Intermittent segfault when using ghc-7.6.3 -e on OSX 10.6.8 ----------------------------------+---------------------------------- Reporter: rampion | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------+---------------------------------- Comment (by thoughtpolice): If you're using Snow Leopard, yes, there will be problems. From what I remember, I think the reason for this has something to do with the fact the build machines use XCode 4.1+ (which is only available on Lion and beyond,) and that causes weird dynamic linking behavior when running on older OS X machines. Here's an idea. Last year I made a build of GHC 7.4.1 on OS X Snow Leopard, using GHC 7.2.1 ( the last binary distribution built on Snow Leopard IIRC.) I think it is an official release and not an RC, if I remember correctly: http://community.haskell.org/~thoughtpolice/ghc-741-osx-sl/ I would suggest using the binary distribution (.bz2) and not the installer. This way you can install it to another directory using `./configure --prefix=$HOME/ghc-741-sl; make install`, and then set your `$PATH` appropriately to use it. Can you then try and build the 7.6.3 source code? See if GHCi works correctly. Unfortunately I no longer have access to any pre-Mountain Lion OS X machines. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8094#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8094: Intermittent segfault when using ghc-7.6.3 -e on OSX 10.6.8 ----------------------------------+---------------------------------- Reporter: rampion | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------+---------------------------------- Comment (by rampion): The ghc-7.6.3 rebuilt from source doesn't seem to display the segfaulting behaviour: {{{ % cd ~/ghc-7.6.3-installed/bin % ./ghc -e 0 0 % ./ghc -e 0 0 % ./ghc -e 0 0 }}} So I'm happy. I ran `make test` on the install: {{{ % cd ~/ghc-7.6.3-source % make test ... OVERALL SUMMARY for test run started at Fri Jul 26 03:41:47 EDT 2013 3403 total tests, which gave rise to 14437 test cases, of which 0 caused framework failures 11363 were skipped 2982 expected passes 47 had missing libraries 35 expected failures 0 unexpected passes 10 unexpected failures Unexpected failures: ffi/should_run fptr02 [bad exit code] (normal) ghci/linking ghcilink003 [bad exit code] (normal) ghci/linking ghcilink006 [bad exit code] (normal) perf/compiler T4801 [stat too good] (normal) perf/compiler T5642 [stat too good] (normal) perf/compiler T6048 [stat not good enough] (optasm) perf/compiler T783 [stat not good enough] (normal) perf/haddock haddock.Cabal [stat not good enough] (normal) perf/haddock haddock.base [stat not good enough] (normal) perf/haddock haddock.compiler [stat not good enough] (normal) }}} So not perfect, but I'm not familiar enough with the test suite to say whether it's good enough. There still seem to be some weird linking issues, because when I moved my source directory to an alternate location, I got similar shared object warnings in gdb: {{{ % mv ~/ghc-7.6.3-source ~/they-will-never-look-for-me-here % cd ~/ghc-7.6.3-installed/lib/ghc-7.6.3/ % gdb ./ghc GNU gdb 6.3.50-20050815 (Apple version gdb-1515) (Sat Jan 15 08:33:48 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"...Reading symbols for shared libraries .... done warning: Could not find object file "/Users/rampion/ghc-7.6.3-source/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/rampion/ghc-7.6.3-source/rts/dist/build/libHSrts_thr.a(types.o)" - no debug information available for "../src/types.c". warning: Could not find object file "/Users/rampion/ghc-7.6.3-source/rts/dist/build/libHSrts_thr.a(ffi64.o)" - no debug information available for "../src/x86/ffi64.c". warning: Could not find object file "/Users/rampion/ghc-7.6.3-source/rts/dist/build/libHSrts_thr.a(darwin64.o)" - no debug information available for "/var/folders/E2/E2IvfJ2xE4C08q9IjJeZfE+++TI/-Tmp-//ccugdkbo.s". (gdb) }}} But this turns out to be not an indicator of whether the segfaulting behaviour will occur, as `~/ghc-7.6.3-installed/bin/ghc -e 0` still works fine consistently. Thanks! I'd be happy to package this build up for other Snow Leopard users, if you think that's appropriate. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8094#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8094: Intermittent segfault when using ghc-7.6.3 -e on OSX 10.6.8 ----------------------------------+---------------------------------- Reporter: rampion | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------+---------------------------------- Comment (by Ptharien's Flame): I'd just like to say that this kind of thing, (the weird `ian` thing, that is), happens on Mountain Lion with the bindist of 7.6.3 as well. I got it while trying to install the `llvm-general` package. For me, it was a compile-time crash, though. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8094#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8094: Intermittent segfault when using ghc-7.6.3 -e on OSX 10.6.8 ----------------------------------+---------------------------------- Reporter: rampion | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------+---------------------------------- Comment (by thoughtpolice): `llvm-general` depends on Template Haskell which would invoke the dynamic linker (akin to invoking GHCi,) so it would probably cause the exact same fault. That said, Snow Leopard users building compatible packages is welcome. For Haskell Platform packages, you probably want to contact Mark Lentczner for details. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8094#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8094: Intermittent segfault when using ghc-7.6.3 -e on OSX 10.6.8 ----------------------------------+---------------------------------- Reporter: rampion | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------+---------------------------------- Comment (by blitzcode): As far as I can tell ever since HP 2012.2.0.0 / GHC 7.4.1 'ghc -e' has been broken on 10.6 / 64bit. 32bit continuous to work just fine, though. I just tried building 7.6.3 from source using the HP 2013.2.0.0 GHC 7.6.3 + XCode 4.1, and I still have no luck with 'ghc -e', same crash, it seems. So it's not just the >4.1 XCode build environment that causes an issue then? I would be great if the upcoming HP release would work on 10.6 64bit again. I'm no GHC hacker, but if there's anything I can try out / test that helps to resolve the issue, please let me know. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8094#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8094: Intermittent segfault when using ghc-7.6.3 -e on OSX 10.6.8 ----------------------------------------+---------------------------------- Reporter: rampion | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | ----------------------------------------+---------------------------------- Changes (by thomie): * status: new => infoneeded Comment: Can someone on Mac OS X 64-bit verify that `ghc -e` works now, with ghc 7.8.3 (haskell platform 2014.02). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8094#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8094: Intermittent segfault when using ghc-7.6.3 -e on OSX 10.6.8 ----------------------------------------+---------------------------------- Reporter: rampion | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | ----------------------------------------+---------------------------------- Comment (by Ptharien's Flame): It seems to work just fine for me, although I don't know how much of a stress test my normal development workflow is. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8094#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8094: Intermittent segfault when using ghc-7.6.3 -e on OSX 10.6.8 ----------------------------------------+---------------------------------- Reporter: rampion | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: worksforme | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | ----------------------------------------+---------------------------------- Changes (by thomie): * status: infoneeded => closed * resolution: => worksforme Comment: Thanks for the input, let's close this then. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8094#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC