[GHC] #11009: Errors reading stdin on Windows

#11009: Errors reading stdin on Windows -------------------------------------+------------------------------------- Reporter: ncreep | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: | Version: 7.10.2 libraries/base | Keywords: | Operating System: Windows Architecture: x86_64 | Type of failure: Incorrect result (amd64) | at runtime Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Hi, I'm running GHC 7.10.2 on Windows 7 x64. Given this code that reads bytes of `stdin`: {{{#!hs import Foreign.C import Foreign import System.Posix.Internals import qualified GHC.IO.FD as FD readStdin bytes = allocaBytes bytes $ \p -> throwErrnoIfMinus1 "" $ c_safe_read (FD.fdFD FD.stdin) p (fromIntegral bytes) }}} Running {{{#!hs readStdin (32 * 1024) }}} Throws the following {{{ *** Exception: resource exhausted (Not enough space) }}} Taking less bytes, e.g. `readStdin (30 * 1024)`, runs as expected. This code is motivated by [[https://github.com/haskell/bytestring/issues/35|this]] issue in the `bytestring` library. This is essentially a minimization of the error case [[https://github.com/haskell/bytestring/issues/35#issuecomment-148954406|here]]. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11009 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11009: Errors reading stdin on Windows -------------------------------------+------------------------------------- Reporter: ncreep | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: libraries/base | Version: 7.10.2 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 Type of failure: Incorrect result | (amd64) at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): Hi, Thanks for the report. I don't seem to be able to reproduce this error on any of my `GHC` versions (`7.8.x`, `7.10.x` or `HEAD`) {{{ GHCi, version 7.11.20151029: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Main ( test.hs, interpreted ) Ok, modules loaded: Main. *Main> readStdin (32 * 1024) a 3 *Main> readStdin (320 * 1024) a 3 }}} I assume you're running this in `GHCi` as well? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11009#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11009: Errors reading stdin on Windows -------------------------------------+------------------------------------- Reporter: ncreep | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: libraries/base | Version: 7.10.2 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 Type of failure: Incorrect result | (amd64) at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by ncreep): It fails in `GHCi` as well. And using a `7.8` GHC yields the same error. Is there anything I can do to further pinpoint the failure? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11009#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11009: Errors reading stdin on Windows -------------------------------------+------------------------------------- Reporter: ncreep | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: libraries/base | Version: 7.10.2 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 Type of failure: Incorrect result | (amd64) at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): I am not sure, I don't see any debug statements around the allocation code, but take a look here https://ghc.haskell.org/trac/ghc/wiki/Debugging -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11009#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11009: Errors reading stdin on Windows -------------------------------------+------------------------------------- Reporter: ncreep | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: libraries/base | Version: 7.10.2 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 Type of failure: Incorrect result | (amd64) at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by ncreep): Thanks, I tried using `gdb`, after running the code, the command `where` says `No stack.`. I've no experience with `gdb` so maybe I'm doing something wrong. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11009#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11009: Errors reading stdin on Windows -------------------------------------+------------------------------------- Reporter: ncreep | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: libraries/base | Version: 7.10.2 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 Type of failure: Incorrect result | (amd64) at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by gershomb): * cc: gershomb (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11009#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC