Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#2164 closed bug (fixed)

zmachine: internal error: task 0xa031e0: main thread 1 has been GC'd

Reported by: guest Owned by: simonmar
Priority: high Milestone: 6.8.3
Component: Compiler (FFI) Version: 6.8.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: x86_64 (amd64)
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by igloo)

So, I was recently looking at ZMachine, which is an emulator written in Haskell for the Infocom text adventures. It can be gotten from darcs here: <http://naesten.dyndns.org:8080/repos/ZMachine>.

Anyway, I did some editing and installed and I tried it out on one of the text adventures SamB included in the repo:

gwern@localhost:1013~/bin/ZMachine>zmachine Museum.z5                                                                               [10:06PM]
[finding abbrev 0 at $84][finding abbrev 1 at $8c][(0,"look"),(5,"map")]
[(0,"look"),(5,"map")]
zmachine: internal error: task 0xa031e0: main thread 1 has been GC'd
(GHC version 6.8.2 for x86_64_unknown_linux)
Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
zsh: abort      zmachine Museum.z5

In this case, one of the objects in the room was a map, so I typed in the sensible 'look map', and that is what happened. (In case you were wondering, 'look at map' works fine, but you can then go 'look map' and it crashes with the same exact error.)

SamB doesn't remember putting in anything dangerous which he'd expect to do that. More importantly, when he runs from the same repo and tries out the same sequence he sees:

21:57 < SamB> [finding abbrev 0 at $84][finding abbrev 1 at $8c][(0,"look"),(5,"map")]
21:57 < SamB> [(0,"look"),(5,"map")]

No crash. He says he's on a Pentium 4, i386 architecture, while I'm using a quad-core Intel (x86_64, ~amd64 Gentoo)

---

SamB: Linux hydrogen 2.6.22-2-686 #1 SMP Fri Aug 31 00:24:01 UTC 2007 i686 GNU/Linux

gwern@localhost:1013~/bin/ZMachine>uname -a                                                                                         [10:07PM]
Linux localhost 2.6.24-gentoo-r3 #6 SMP PREEMPT Fri Mar 14 21:40:34 EDT 2008 x86_64 Intel(R) Core(TM)2 Quad CPU @ 2.40GHz GenuineIntel GNU/Linux

gwern@localhost:1014~/bin/ZMachine>ghc-pkg list                                                                                     [10:12PM]
/usr/lib64/ghc-6.8.2/package.conf:
    ALUT-2.1.0.0, Cabal-1.2.3.0, GLUT-2.1.1.1, HDBC-1.1.4,
    HDBC-odbc-1.1.4.0, HDBC-postgresql-1.1.4.0, HDBC-sqlite3-1.1.4.0,
    HGL-3.2.0.0, HTTP-3001.0.4, HUnit-1.2.0.0, OpenAL-1.3.1.1,
    OpenGL-2.2.1.1, QuickCheck-1.1.0.0, Stream-0.2.2, X11-1.4.1,
    X11-xft-0.2, array-0.1.0.0, arrows-0.3, base-3.0.1.0,
    bytestring-0.9.0.1, bytestring-0.9.0.4, bzlib-0.4.0.1,
    cairo-0.9.12.1, cgi-3001.1.5.2, containers-0.1.0.1, cpphs-1.5,
    directory-1.0.0.0, fgl-5.4.1.1, filepath-1.1.0.0, fingertree-0.0,
    (ghc-6.8.2), glade-0.9.12.1, glib-0.9.12.1, gtk-0.9.12.1,
    gtkglext-0.9.12.1, harp-0.2, haskell-src-1.0.1.1,
    haskell-src-exts-0.2, haskell98-1.0.1.0, hpc-0.5.0.0, hscolour-1.9,
    hslogger-1.0.4, hsql-1.7, hsql-mysql-1.7, hsql-odbc-1.7,
    hsql-postgresql-1.7, hsql-sqlite3-1.7, html-1.0.1.1, hxt-7.5,
    iconv-0.4, mtl-1.1.0.0, network-2.1.0.0, old-locale-1.0.0.0,
    old-time-1.0.0.0, packedstring-0.1.0.0, parallel-1.0.0.0,
    parsec-2.1.0.0, polyparse-1.1, pretty-1.0.0.0, process-1.0.0.0,
    random-1.0.0.0, readline-1.0.1.0, regex-base-0.72.0.1,
    regex-compat-0.71.0.1, regex-posix-0.72.0.2, rts-1.0,
    soegtk-0.9.12.1, stm-2.1.1.0, svgcairo-0.9.12.1, tagsoup-0.4,
    template-haskell-2.2.0.0, time-1.1.2.0, unix-2.3.0.0,
    utf8-string-0.2, uulib-0.9.5, xhtml-3000.0.2.2, xmonad-0.6,
    xmonad-contrib-0.6
/home/gwern/.ghc/x86_64-linux-6.8.2/package.conf:
    AGI-1.1.1, ArrayRef-0.1, AvlTree-2.4, CC-delcont-0.2,
    COrdering-2.1, Cabal-1.3.3, Cabal-1.3.6, Cabal-1.3.7, Chart-0.5,
    ChasingBottoms-1.2.2, Codec-Compression-LZF-0.2, ConfigFile-1.0.4,
    Conjure-0.1, ContArrow-0.0.3, Crypto-4.1.0, DBus-0.1,
    DeepArrow-0.0.1, DisTract-0.2.5, EdisonAPI-1.2.1,
    EdisonCore-1.2.1.1, Encode-0.7, Etherbunny-0.3, FileManip-0.3.1,
    Finance-Quote-Yahoo-0.4.1, FiniteMap-0.1, GLFW-0.2, GLUT-2.1.1.1,
    HAppS-Data-0.9.1, HAppS-IxSet-0.9.1, HAppS-Server-0.9.1,
    HAppS-State-0.9.1, HAppS-Util-0.9.1, HCL-1.2, HFuse-0.1,
    HGL-3.2.0.0, HList-0.1, {HPDF-1.3}, HSH-1.2.5, HStringTemplate-0.1,
    HTF-0.1, HTTP-3001.0.0, HTTP-Simple-0.1, HaLex-1.1, HaXml-1.13.3,
    HaXml-1.19.2, HsJudy-0.1, HsJudy-0.1.1, HsOpenSSL-0.3.1,
    HsSyck-0.41, HsSyck-0.42, IFS-0.1.1, IOSpec-0.1.1, Imlib-0.1,
    IndentParser-0.2.1, ListLike-1.0.1, MaybeT-0.1.1, MissingH-1.0.0,
    NewBinary-0.1, OpenGL-2.2.1.1, PArrows-0.1, PostgreSQL-0.2,
    Postmaster-0.1, QuickCheck-2.0, RJson-0.1, Ranged-sets-0.1.1,
    Safe-0.1, Shellac-0.9.1, Shellac-readline-0.9, TV-0.2,
    TypeCompose-0.3, TypeCompose-0.4, {Unixutils-1.14}, X11-1.4.1,
    X11-1.4.1.20080127, X11-xft-0.2, YamlReference-0.6, ZFS-0.0,
    anydbm-1.0.4, anydbm-1.0.5, base64-string-0.1, bencode-0.3,
    binary-0.4.1, binary-strict-0.1, binary-strict-0.2.1,
    binary-strict-0.2.2, binary-strict-0.3.0, bio-0.2, bio-0.3.3,
    bktrees-0.2.1, blockio-0.0-2006-02-03, bytestring-0.9.0.1,
    bytestring-0.9.0.4, cgi-3001.1.5.1, cgi-3001.1.5.2,
    cgi-undecidable-3000.0.0, child-0.0-2005-02-14, chunks-2007.4.18,
    condorcet-0.0.1, csv-0.1.1, curl-1.3.2, dataenc-0.10.2,
    dbus-haskell-0.1, {debian-1.2}, denominate-0.4.1, derive-0.1,
    derive-0.1.1, dimensional-0.7.2, dlist-0.4, dsp-0.2.1,
    encoding-0.3, event-list-0.0.5, exif-3000.0.0, fec-0.1.1,
    filepath-1.1.0.0, fingertree-0.0, fixpoint-0.1, flock-0.1,
    folkung-2.3, frag-1.1, fst-0.9, ftphs-1.0.4, gal-1.0, gd-3000.4.0,
    genericserialize-0.1, greencard-3.0.1, greencard-lib-3.0.1,
    haddock-2.0.0.0, haddock-2.1.0, halfs-0.2, harp-0.2.1, harpy-0.4,
    haskell-src-exts-0.2.1, haskelldb-0.11, haxr-3000.0.1,
    hera-ajaxgui-2.1-dev, hera-engine-2.1-dev, hera-prelude-2.1-dev,
    hfov-1, hinotify-0.2, hinstaller-2007.5.13, hmarkup-3000.0.1,
    hmatrix-0.2.0.0, hopenssl-0.0-2005-02-14, hosc-0.1, hosc-0.2,
    hs-fltk-0.2.5, hsc3-0.2, hscurses-1.1, hscurses-1.2, hscurses-1.3,
    hsdns-1.1, hsemail-1.1, hslogger-1.0.2, hslua-0.2, hsntp-0.1,
    hsp-0.2, hspr-sh-0.3, hspread-0.2, hstats-0.2, hstringtemplate-0.1,
    html-1.0.1.1, hybrid-2.0, i18n-0.2, i18n-0.3, idris-0.0.1,
    infix-0.1, interlude-0.1, ipprint-0.3, irc-0.4, ivor-0.1.5,
    lax-0.0.0, lazysmallcheck-0.1, libGenI-0.16, libmpd-0.1.3,
    loch-0.2, magic-1.0.7, markov-chain-0.0.1, memcached-0.1,
    mersenne-random-0.1, metaplug-0.1.1, midi-0.0.4, miniplex-0.2.2,
    monad-param-0.0.2, monadLib-3.3.0, monadenv-0.0-2005-02-14,
    mtlparse-0.0.0.5, nano-md5-0.1.1, network-bytestring-0.1.1,
    network-bytestring-0.1.1.2, non-negative-0.0.1, numbers-2007.9.25,
    oeis-0.1, parse-dimacs-1.0, parsedate-3000.0.0, pcap-0.4.2,
    pcre-light-0.2.1, pcre-light-0.3, plugins-1.1, polyparse-1.1,
    popenhs-1.0.0, postmaster-0.1, powermate-0.1, pqc-0.2,
    propgrid-0.1, pugs-HsSyck-0.2, pugs-HsSyck-0.41, pugs-hsregex-1.0,
    pureMD5-0.1.0, pureMD5-0.1.1, rbr-0.7, rbr-0.8.3, reactive-0.4,
    regex-base-0.72.0.1, regex-base-0.93.1, regex-posix-0.72.0.2,
    regex-posix-0.93.1, rss-3000.0.1, safecopy-0.3, scgi-0.1,
    selenium-0.2.2, sessions-2008.2.20, shell-pipe-0.1, simpleargs-0.1,
    smallcheck-0.2, smallcheck-0.2.1, stream-fusion-0.1.1, strict-0.3,
    strict-concurrency-0.1, stringsearch-0.2, supercollider-ht-0.0,
    syb-with-class-0.4, tagsoup-0.3, tagsoup-0.4, tagsoup-0.5,
    tar-0.1.1.1, template-0.1.1.1, terminfo-0.1, type-int-0.3,
    type-level-0.1, uniplate-1.0.1, unix-compat-0.1.2.1,
    unix-pty-light-0.1, value-supply-0.1, vty-3.0.0, whim-0.1,
    wl-pprint-1.0, xhtml-3000.0.2.1, xhtml-3000.0.2.2, xmonad-0.6,
    xmonad-contrib-0.6, xsact-1.6, zlib-0.4.0.2

-- gwern

Attachments (2)

zmachine.strace (236.0 KB) - added by guest 12 years ago.
The output of strace when I run a crashing zmachine
GHC_bug_2164.hs (1.3 KB) - added by wjt 11 years ago.

Download all attachments as: .zip

Change History (10)

Changed 12 years ago by guest

Attachment: zmachine.strace added

The output of strace when I run a crashing zmachine

comment:1 Changed 12 years ago by igloo

Description: modified (diff)
difficulty: Unknown

comment:2 Changed 12 years ago by igloo

Milestone: 6.8.3

Thanks for the report. It would be really useful if someone could boil this down to as small an example as possible. Especially useful, if possible, would be removing the dependency on gtk2hs.

comment:3 Changed 12 years ago by SamB

Architecture: Unknownx86_64 (amd64)
Component: CompilerCompiler (FFI)

Well, I made and pushed a test that doesn't need gtk2hs. Unfortunately, gwern ran it and it didn't crash -- it just said "* Exception: $fd16: exit: ExitSuccess", just like for me. So apparantly this is some kind of wierd bug involving gtk2hs somehow, so I'm changing the component field to "Compiler (FFI)".

comment:4 Changed 11 years ago by simonmar

Owner: set to simonmar

comment:5 Changed 11 years ago by wjt

I can trigger the same internal error on my x86 (Pentium M) with a different example, using gtk2hs, curl and HXT. The attached source file is as far as I can reduce it without the error going away, I'm afraid. The output given is:

before
GHC_bug_2164: internal error: task 0x842ccb8: main thread 1 has been GC'd
    (GHC version 6.8.2 for i386_unknown_linux)
    Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

I cannot reproduce the error using the ZMachine code.

2071 % uname -a; ghc --info
Linux talkie 2.6.24-1-686 #1 SMP Thu May 8 02:16:39 UTC 2008 i686 GNU/Linux
 [("Project name","The Glorious Glasgow Haskell Compilation System")
 ,("Project version","6.8.2")
 ,("Booter version","6.8.2")
 ,("Stage","2")
 ,("Interface file version","6")
 ,("Have interpreter","YES")
 ,("Object splitting","YES")
 ,("Have native code generator","YES")
 ,("Support SMP","YES")
 ,("Unregisterised","NO")
 ,("Tables next to code","YES")
 ,("Win32 DLLs","")
 ,("RTS ways"," debug  thr thr_p thr_debug debug_p thr_debug thr_debug_p")
 ,("Leading underscore","NO")
 ]

2083 % for i in gtk curl hxt; do ghc-pkg list $i; done
/usr/lib/ghc-6.8.2/package.conf:
    gtk-0.9.12.1
/usr/lib/ghc-6.8.2/package.conf:
    curl-1.3.2
/usr/lib/ghc-6.8.2/package.conf:
    hxt-7.5

Changed 11 years ago by wjt

Attachment: GHC_bug_2164.hs added

comment:6 Changed 11 years ago by simonmar

Priority: normalhigh

comment:7 Changed 11 years ago by simonmar

Resolution: fixed
Status: newclosed

Fixed:

Wed May 28 07:39:37 BST 2008  Simon Marlow <marlowsd@gmail.com>
  * FIX #2164: check for ThreadRelocated in isAlive()

I committed this to STABLE only for now, because I don't want to conflict with my parallel GC branch where I've made the equivalent fix.

comment:8 Changed 11 years ago by simonmar

Operating System: UnknownUnknown/Multiple
Note: See TracTickets for help on using tickets.