[GHC] #12912: IO library should not use select()

#12912: IO library should not use select() -------------------------------------+------------------------------------- Reporter: simonmar | Owner: simonmar Type: bug | Status: new Priority: normal | Milestone: 8.0.2 Component: | Version: 8.0.1 libraries/base | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The IO library uses `select()` in `fdReady()`, which fails in processes with more than 1024 file descriptors. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12912 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12912: IO library should not use select()
-------------------------------------+-------------------------------------
Reporter: simonmar | Owner: simonmar
Type: bug | Status: new
Priority: normal | Milestone: 8.0.2
Component: libraries/base | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#12912: IO library should not use select() -------------------------------------+------------------------------------- Reporter: simonmar | Owner: simonmar Type: bug | Status: closed Priority: normal | Milestone: 8.0.2 Component: libraries/base | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12912#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12912: IO library should not use select() -------------------------------------+------------------------------------- Reporter: simonmar | Owner: simonmar Type: bug | Status: closed Priority: normal | Milestone: 8.0.2 Component: libraries/base | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): Merged to `ghc-8.0` as d9e7a69290c39f6075b70c218fbcf7f85682e9cb. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12912#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12912: IO library should not use select() -------------------------------------+------------------------------------- Reporter: simonmar | Owner: simonmar Type: bug | Status: closed Priority: normal | Milestone: 8.0.2 Component: libraries/base | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by nh2): Note this change breaks the following code: {{{ import System.IO import System.Timeout main = hWaitForInput stdin (5 * 1000) }}} See https://ghc.haskell.org/trac/ghc/ticket/8684#comment:8 Is that expected? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12912#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12912: IO library should not use select() -------------------------------------+------------------------------------- Reporter: simonmar | Owner: simonmar Type: bug | Status: closed Priority: normal | Milestone: 8.0.2 Component: libraries/base | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): No, this is certainly not expected. 37d7c1596ee936ec6597a5c1898e1fdca7c04f77 adds a testcase to ensure that we catch this next time. The problem appears to be that the patch assumes that all IO operations go through the IO manager, which will take care of waiting for us. However, `GHC.IO.Handle.Text.hWaitForInput` appears to call `GHC.IO.Fd.ready` directly, which then passes the timeout to `fdReady`. It's not entirely clear what was intended by this comment, {{{#!hs // We only handle msecs == 0 on non-Windows, because this is the // only case we need. Non-zero waiting is handled by the IO manager. }}} Jaffacake, can you clarify how you intended for this work? Where is this IO manager treatment? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12912#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12912: IO library should not use select() -------------------------------------+------------------------------------- Reporter: simonmar | Owner: simonmar Type: bug | Status: closed Priority: normal | Milestone: 8.0.2 Component: libraries/base | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonmar): I think I just missed that we also called into here from `hWaitForInput`, oops. We'll need to do `hWaitForInput` with a non-zero timeout a different way. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12912#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12912: IO library should not use select() -------------------------------------+------------------------------------- Reporter: simonmar | Owner: simonmar Type: bug | Status: closed Priority: normal | Milestone: 8.0.2 Component: libraries/base | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): Alright, I did some grepping and I'm pretty certain that this is the only caller of `ready` that we need to fix. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12912#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12912: IO library should not use select() -------------------------------------+------------------------------------- Reporter: simonmar | Owner: simonmar Type: bug | Status: closed Priority: normal | Milestone: 8.0.2 Component: libraries/base | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #8684, #13525 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by nh2): * related: => #8684, #13525 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12912#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12912: IO library should not use select() -------------------------------------+------------------------------------- Reporter: simonmar | Owner: simonmar Type: bug | Status: closed Priority: normal | Milestone: 8.0.2 Component: libraries/base | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #8684, #13525 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by nh2): This is fixed for GHC 8.2 per #13525 (https://phabricator.haskell.org/rGHCe5732d2a28dfb8a754ee73e124e3558222a543bb) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12912#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC