Opened 6 years ago

Closed 4 years ago

#4415 closed bug (fixed)

ghci crash on Windows 7 64bits when press Ctrl-L

Reported by: isomorphic Owned by: igloo
Priority: highest Milestone: 7.6.2
Component: GHCi Version: 6.12.3
Keywords: windows 7 Cc: judah.jacobson@…
Operating System: Windows Architecture: x86_64 (amd64)
Type of failure: GHCi crash Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by igloo)

Hi All,

On Windows 7 64bits, after launching ghci, press Ctrl-L to clear the screen, and it's crashed with this message:

WriteConsole: resource exhausted (Not enough storage is available to process this command.)

Would any body help to fix it?

Thanks & Regards, Harry

Attachments (1)

haskeline.patch (3.7 KB) - added by fryguybob 6 years ago.
Patch to

Download all attachments as: .zip

Change History (16)

comment:1 Changed 6 years ago by judahj

Do other commands (arrow keys, tab completion, etc.) work for you?

If you type a long line of text (so that the cursor wraps to the next line), then press ctrl-A, then type more text, does it work or also crash?

One other test: This may be an issue with Haskeline, the library we use for command-line input. Can you please run:

cabal install haskeline

and then build and try to run the following program: . Does it have the same problem?

comment:2 Changed 6 years ago by isomorphic

The arrow keys, tab completion, and Ctrl-A, ctrl-e all work fine.

This must be an bug within Haskeline, as I can reproduce the same error with your "Test.hs" when I press "Ctrl-L".

comment:3 Changed 6 years ago by igloo

Description: modified (diff)

comment:4 Changed 6 years ago by igloo

Milestone: 7.0.2

comment:5 Changed 6 years ago by fryguybob

I have all the changes needed to make Ctrl-L work in haskeline for me (on Windows 7 64-bit) based on the second technique listed here The haskeline trac page lists as the source location, but that project isn't up right now, so I'm not sure how to go about making a patch. It also seems like it should be an issue in the haskeline trac.

comment:6 Changed 6 years ago by fryguybob

Status: newpatch

comment:7 Changed 6 years ago by igloo


comment:8 Changed 6 years ago by igloo

Owner: set to judahj

Hi Judah, are you able to review Windows patches, or will someone else need to look at this?

comment:9 Changed 5 years ago by igloo


comment:10 Changed 5 years ago by simonpj

Cc: judah.jacobson@… added
difficulty: Unknown

Judah, any progress? Thanks.


comment:11 Changed 5 years ago by judahj

I did some more investigation on this issue today; I should be able to push a fix within the next couple of days.

comment:12 Changed 5 years ago by judahj

I've pushed some patches to which fix this and a couple related issues:

Wed Jul 18 13:59:56 PDT 2012  Judah Jacobson <>
  * Fix ctrl-L on Windows with large console window sizes (GHC ticket #4415).
  Here "large" means an area of >2^15 cells, e.g., 200x200.
  Original patch by

Wed Jul 18 14:03:25 PDT 2012  Judah Jacobson <>
  * Prevent crash on Windows when writing many characters at once.
  A couple cases which are known to have triggered this are:
  - Entering a long (>2^15) input line
  - Tab-completing a folder containing many files, with completionPaging:False

The problem turned out not to be related to the version of Windows. Instead, It is caused by haskeline's use of the WriteConsoleW API function, which can only handle inputs of up to to ~215 bytes. You can reproduce this issue by expanding your console window to 200x200 characters, starting ghci, and then pressing ctrl-L.

I've tested the above patches on Windows Vista, but they should also fix the problem on Windows 7. Would someone else be able to confirm that the issue has been resolved on that OS?

comment:13 Changed 5 years ago by igloo

Owner: changed from judahj to igloo
Priority: normalhighest

I can check on Windows 7.

comment:14 Changed 5 years ago by judahj

The above patches should fix the issue, and were released in haskeline- Was that version (or later) used in ghc-7.6.1? If so, was the issue resolved?

comment:15 Changed 4 years ago by igloo

Resolution: fixed
Status: patchclosed

I couldn't get it to crash in any sort of terminal on Windows 7, so I believe this is fixed. Thanks Judah!

Note: See TracTickets for help on using tickets.