[GHC] #14271: ghci hangs with -fexternal-interpreter -prof

#14271: ghci hangs with -fexternal-interpreter -prof ----------------------------------------+------------------------------- Reporter: AndreasK | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Keywords: | Operating System: Windows Architecture: Unknown/Multiple | Type of failure: GHCi crash Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: ----------------------------------------+------------------------------- {{{ ghci -fexternal-interpreter -prof GHCi, version 8.2.1: http://www.haskell.org/ghc/ :? for help Access violation in generated code when reading 00000001001e0418 }}} * The address remains the same between reruns (and reinstalls) of ghc. * Closing the hanging process leaves the launched ghc active in the background. * The directory I launch ghci from doesn't seem to matter. * I have only tried it on my desktop so far (Win10/Skylake) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14271 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14271: ghci hangs with -fexternal-interpreter -prof -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by AndreasK): * type: bug => feature request Comment: Turns out it's just not supported on Windows. Since I couldn't find another ticket turning this into a feature request. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14271#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14271: ghci hangs with -fexternal-interpreter -prof -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * cc: Jaffacake (added) Comment: Is this true? We should probably throw a proper error if this is the case. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14271#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14271: ghci hangs with -fexternal-interpreter -prof -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * cc: Phyx- (added) Comment: Tamar, do you know what is going on here? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14271#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14271: ghci hangs with -fexternal-interpreter -prof -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): @bgamari, no, I've never used `fexternal-interpreter` aside from the initial implementation stuff for Windows. I'm having trouble with building a profiled debug build so I'll have to sort that out first before I can debug this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14271#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14271: ghci hangs with -fexternal-interpreter -prof -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): I don't have an 8.2 installation handy, but I can't reproduce this on master. {{{ Tamar@Rage ~/ghc> inplace/bin/ghc-stage2.exe --interactive -fexternal- interpreter -prof GHCi, version 8.3.20171008: http://www.haskell.org/ghc/ :? for help Prelude> 1+1 2 Prelude> :q Leaving GHCi. Tamar@Rage ~/ghc> inplace/bin/ghci.exe -fexternal-interpreter -prof WARNING: GHCi invoked via 'ghci.exe' in MinTTY consoles (e.g., Cygwin or MSYS) doesn't handle Ctrl-C well; use the 'ghcii.sh' shell wrapper instead GHCi, version 8.3.20171008: http://www.haskell.org/ghc/ :? for help Prelude> :q Leaving GHCi. }}} @AndreasK have you tried with master? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14271#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14271: ghci hangs with -fexternal-interpreter -prof -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by AndreasK): When I tried back then it failed on master with a different Error then on 8.2. It works on the current head it seems. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14271#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14271: ghci hangs with -fexternal-interpreter -prof -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): That's slightly worrying.. Do you happen to know which commit you were on before? I'd like to bisected this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14271#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14271: ghci hangs with -fexternal-interpreter -prof -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by AndreasK): Replying to [comment:7 Phyx-]:
That's slightly worrying.. Do you happen to know which commit you were on before? I'd like to bisected this.
At commit a4ee28978acbcf68da9dfb6f198cb6e1ff38ccca on the tree I had on my laptop with a validating build. Seems like an error independent of the other issue though. {{{ inplace/bin/ghci.exe -fexternal-interpreter -prof WARNING: GHCi invoked via 'ghci.exe' in MinTTY consoles (e.g., Cygwin or MSYS) doesn't handle Ctrl-C well; use the 'ghcii.sh' shell wrapper instead GHCi, version 8.3.20171003: http://www.haskell.org/ghc/ :? for help <interactive>:1:19: error: Not in scope: `System.IO.hSetBuffering' No module named `System.IO' is imported. <interactive>:1:43: error: Not in scope: `System.IO.stdin' No module named `System.IO' is imported. <interactive>:1:60: error: Not in scope: data constructor `System.IO.NoBuffering' No module named `System.IO' is imported. <interactive>:1:81: error: Not in scope: `GHC.Base.thenIO' No module named `GHC.Base' is imported. <interactive>:1:99: error: Not in scope: `System.IO.hSetBuffering' No module named `System.IO' is imported. <interactive>:1:123: error: Not in scope: `System.IO.stdout' No module named `System.IO' is imported. <interactive>:1:140: error: Not in scope: data constructor `System.IO.NoBuffering' No module named `System.IO' is imported. <interactive>:1:161: error: Not in scope: `GHC.Base.thenIO' No module named `GHC.Base' is imported. <interactive>:1:179: error: Not in scope: `System.IO.hSetBuffering' No module named `System.IO' is imported. <interactive>:1:203: error: Not in scope: `System.IO.stderr' No module named `System.IO' is imported. <interactive>:1:220: error: Not in scope: data constructor `System.IO.NoBuffering' No module named `System.IO' is imported. }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14271#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14271: ghci hangs with -fexternal-interpreter -prof -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Resolution: | Keywords: RemoteGHCi Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonmar): * cc: Jaffacake (removed) * cc: simonmar (added) * keywords: => RemoteGHCi -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14271#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14271: External interpreter is broken -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Resolution: duplicate | Keywords: RemoteGHCi Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #16162 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => duplicate * related: => #16162 Comment: I'm going to close this in favor of #16162. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14271#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14271: ghci hangs with -fexternal-interpreter -prof -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Resolution: duplicate | Keywords: RemoteGHCi Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #16162 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14271#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14271: ghci hangs with -fexternal-interpreter -prof -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Resolution: duplicate | Keywords: RemoteGHCi Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #16162 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): For the record, I have reported a number of external-interpreter-related testsuite failures on Windows in #16156. The most common failure mode is the test timing-out, which I suspect is due to this hang reported in this ticket. My suspicion is that GHC's logic to detect the death of its `iserv` process is broken on Windows. I did the following to test this: 1. start `ghci -fexternal-interpreter` 2. issue a kill request against its associated interpreter process (using the "kill" command in Process Explorer) 3. try evaluating `print "hello"` 4. observe that `ghci` indeed hangs However, I should note that in this experiment the kill request against the interpreter doesn't actually kill the interpreter process. Rather it seems to merely hang. Issuing a *second* kill command indeed kills it, at which point `ghci` realizes the interpreter is dead and terminates. The backtrace of the interpreter process in its hung state looks like the following: {{{ (gdb) thread apply all bt Thread 6 (Thread 9232.0x19ac): #0 0x00007ffa06549351 in ntdll!DbgBreakPoint () from /c/Windows/SYSTEM32/ntdll.dll #1 0x00007ffa065710ba in ntdll!DbgUiRemoteBreakin () from /c/Windows/SYSTEM32/ntdll.dll #2 0x00007ffa061c8364 in KERNEL32!BaseThreadInitThunk () from /c/Windows/System32/KERNEL32.DLL #3 0x00007ffa0650e851 in ntdll!RtlUserThreadStart () from /c/Windows/SYSTEM32/ntdll.dll #4 0x0000000000000000 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 5 (Thread 9232.0x1c5c): #0 0x00007ffa06545b84 in ntdll!ZwWaitForSingleObject () from /c/Windows/SYSTEM32/ntdll.dll #1 0x00007ffa03413ebf in WaitForSingleObjectEx () from /c/Windows/System32/KERNELBASE.dll #2 0x0000000003d70543 in waitCondition (pCond=pCond@entry=0x6c2c768, pMut=pMut@entry=0x6c2c770) at rts\win32\OSThreads.c:87 #3 0x0000000003d54d60 in waitForWorkerCapability (task=0x6c2c760) at rts\Capability.c:651 #4 yieldCapability (pCap=pCap@entry=0x857fe88, task=task@entry=0x6c2c760, gcAllowed=gcAllowed@entry=true) at rts\Capability.c:888 #5 0x0000000003d57191 in scheduleYield (task=0x6c2c760, pcap=0x857fea0) at rts\Schedule.c:672 #6 schedule (initialCapability=<optimized out>, task=<optimized out>, task@entry=0x6c2c760) at rts\Schedule.c:292 #7 0x0000000003d5826f in scheduleWorker (cap=<optimized out>, task=0x6c2c760) at rts\Schedule.c:2550 #8 0x0000000003d7e4f8 in workerStart (task=0x6c2c760) at rts\Task.c:444 #9 0x00007ffa061c8364 in KERNEL32!BaseThreadInitThunk () from /c/Windows/System32/KERNEL32.DLL #10 0x00007ffa0650e851 in ntdll!RtlUserThreadStart () from /c/Windows/SYSTEM32/ntdll.dll #11 0x0000000000000000 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 4 (Thread 9232.0x20b8): #0 0x00007ffa06545b84 in ntdll!ZwWaitForSingleObject () from /c/Windows/SYSTEM32/ntdll.dll #1 0x00007ffa03413ebf in WaitForSingleObjectEx () from /c/Windows/System32/KERNELBASE.dll #2 0x0000000003d70543 in waitCondition (pCond=pCond@entry=0x4d8ee88, pMut=pMut@entry=0x4d8ee90) at rts\win32\OSThreads.c:87 #3 0x0000000003d54d60 in waitForWorkerCapability (task=0x4d8ee80) at rts\Capability.c:651 #4 yieldCapability (pCap=pCap@entry=0x770fe88, task=task@entry=0x4d8ee80, gcAllowed=gcAllowed@entry=true) at rts\Capability.c:888 #5 0x0000000003d57191 in scheduleYield (task=0x4d8ee80, pcap=0x770fea0) at rts\Schedule.c:672 #6 schedule (initialCapability=<optimized out>, task=<optimized out>, task@entry=0x4d8ee80) at rts\Schedule.c:292 #7 0x0000000003d5826f in scheduleWorker (cap=<optimized out>, task=0x4d8ee80) at rts\Schedule.c:2550 #8 0x0000000003d7e4f8 in workerStart (task=0x4d8ee80) at rts\Task.c:444 #9 0x00007ffa061c8364 in KERNEL32!BaseThreadInitThunk () from /c/Windows/System32/KERNEL32.DLL #10 0x00007ffa0650e851 in ntdll!RtlUserThreadStart () from /c/Windows/SYSTEM32/ntdll.dll #11 0x0000000000000000 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 3 (Thread 9232.0x2098): #0 0x00007ffa06545b84 in ntdll!ZwWaitForSingleObject () from /c/Windows/SYSTEM32/ntdll.dll #1 0x00007ffa03413ebf in WaitForSingleObjectEx () from /c/Windows/System32/KERNELBASE.dll #2 0x0000000003c5745d in caqi_info () #3 0x0000000004d8e7e0 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 2 (Thread 9232.0x7ac): #0 0x00007ffa065492d4 in ntdll!ZwWaitForWorkViaWorkerFactory () from /c/Windows/SYSTEM32/ntdll.dll #1 0x00007ffa064c9e4e in ntdll!RtlReleaseSRWLockExclusive () from /c/Windows/SYSTEM32/ntdll.dll #2 0x00007ffa061c8364 in KERNEL32!BaseThreadInitThunk () from /c/Windows/System32/KERNEL32.DLL #3 0x00007ffa0650e851 in ntdll!RtlUserThreadStart () from /c/Windows/SYSTEM32/ntdll.dll #4 0x0000000000000000 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 1 (Thread 9232.0x18d4): #0 0x00007ffa06545c04 in ntdll!ZwWriteFile () from /c/Windows/SYSTEM32/ntdll.dll #1 0x00007ffa034140e6 in WriteFile () from /c/Windows/System32/KERNELBASE.dll #2 0x00007ffa052e03db in msvcrt!_write () from /c/Windows/System32/msvcrt.dll #3 0x00007ffa052dfcca in msvcrt!_write () from /c/Windows/System32/msvcrt.dll #4 0x0000000003b2cc20 in s9ja_info () #5 0x0000000000000006 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14271#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14271: ghci hangs with -fexternal-interpreter -prof -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: Component: GHCi | Version: 8.2.1 Resolution: duplicate | Keywords: RemoteGHCi Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #16162 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): It looks like thread 4 and 5 are blocked waiting for something. Can you print the tasks's blocked reason? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14271#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC