Opened 5 years ago

Closed 3 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 Revisions:

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 4 years ago.
Patch to http://darcs.haskell.org/ghc-7.0/packages/haskeline

Download all attachments as: .zip

Change History (16)

comment:1 Changed 5 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:
http://code.haskell.org/haskeline/examples/Test.hs . Does it have the same problem?

comment:2 Changed 5 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 5 years ago by igloo

  • Description modified (diff)

comment:4 Changed 5 years ago by igloo

  • Milestone set to 7.0.2

comment:5 Changed 4 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 http://support.microsoft.com/kb/99261. The haskeline trac page lists http://code.haskell.org/haskeline 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 4 years ago by fryguybob

  • Status changed from new to patch

comment:7 Changed 4 years ago by igloo

  • Milestone changed from 7.0.2 to 7.2.1

comment:8 Changed 4 years ago by igloo

  • Milestone changed from 7.2.1 to 7.4.1
  • 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 3 years ago by igloo

  • Milestone changed from 7.4.1 to 7.6.1

comment:10 Changed 3 years ago by simonpj

  • Cc judah.jacobson@… added
  • difficulty set to Unknown

Judah, any progress? Thanks.

Simon

comment:11 Changed 3 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 3 years ago by judahj

I've pushed some patches to code.haskell.org/haskeline which fix this and a couple related issues:

Wed Jul 18 13:59:56 PDT 2012  Judah Jacobson <[email protected]>
  * 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 [email protected]

Wed Jul 18 14:03:25 PDT 2012  Judah Jacobson <[email protected]>
  * 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 3 years ago by igloo

  • Milestone changed from 7.6.1 to 7.6.2
  • Owner changed from judahj to igloo
  • Priority changed from normal to highest

I can check on Windows 7.

comment:14 Changed 3 years ago by judahj

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

comment:15 Changed 3 years ago by igloo

  • Resolution set to fixed
  • Status changed from patch to closed

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.