[GHC] #10736: threadWaitRead/registerFd unusable

#10736: threadWaitRead/registerFd unusable -------------------------------------+------------------------------------- Reporter: mboes | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | -------------------------------------+------------------------------------- The following program: {{{ module Main where import System.Posix.IO import GHC.Event main = do Just mgr <- getSystemEventManager fd <- openFd "/tmp/bleh" ReadOnly Nothing defaultFileFlags { nonBlock = True } key <- registerFd mgr (\_ _ -> putStrLn "hello") fd evtRead MultiShot return () }}} fails with: {{{ *** Exception: modifyFdOnce: permission denied (Operation not permitted) }}} Since `threadWaitRead` and family are implemented in terms of `registerFd`, they also fail with the same error. Perhaps I am misunderstanding how to use this function, but in this case the conditions that must hold true regarding file descriptors should be documented somewhere. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10736 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10736: threadWaitRead/registerFd unusable -------------------------------------+------------------------------------- Reporter: mboes | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by bgamari): What operating system is this on? The trouble is that the behavior of the functions backing the event manager are a bit platform-specific (in this way, it's a bit of a leaky abstraction, although I'm not sure we can do much better). Moreover, the platforms' documentation in this area tends to be quite poor, even in the case of Linux. In this particular case, you are running into the fact that `epoll` is [http://stackoverflow.com/questions/8057892/epoll-on-regular-files not] [http://stackoverflow.com/questions/8645721/why-does-select-select-work- with-disk-files-but-not-epoll?lq=1 supported] on regular files (the fact that this answer refers to the kernel's `eventpoll.c` for a definitive answer is an indication of just how lacking the documentation is in this area). I would like to improve the documentation for the event manager interfaces, but it require time to sort out where the relevant information can be found in the various platform documentation sources. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10736#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10736: threadWaitRead/registerFd unusable -------------------------------------+------------------------------------- Reporter: mboes | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by mboes): I see! That makes sense. So shall we close this ticket and open a new one for documentation? What we want to document here I'm guessing is simply that the behaviour of registerFd is system dependent, and that some systems might impose restrictions on the types of FD that work and ones that do not. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10736#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10736: threadWaitRead/registerFd unusable -------------------------------------+------------------------------------- Reporter: mboes | Owner: bgamari Type: bug | Status: new Priority: normal | Milestone: Component: Documentation | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Documentation | Unknown/Multiple bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by thomie): * owner: => bgamari * failure: None/Unknown => Documentation bug * component: Compiler => Documentation -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10736#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10736: threadWaitRead/registerFd unusable
-------------------------------------+-------------------------------------
Reporter: mboes | Owner: bgamari
Type: bug | Status: new
Priority: normal | Milestone:
Component: Documentation | Version: 7.10.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Documentation | Unknown/Multiple
bug | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#10736: threadWaitRead/registerFd unusable -------------------------------------+------------------------------------- Reporter: mboes | Owner: bgamari Type: bug | Status: closed Priority: normal | Milestone: 8.0.1 Component: Documentation | Version: 7.10.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Documentation | Unknown/Multiple bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * status: new => closed * resolution: => fixed * milestone: => 8.0.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10736#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC