[GHC] #13247: hPutBufNonBlocking can block

#13247: hPutBufNonBlocking can block -------------------------------------+------------------------------------- Reporter: nh2 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: #13246, #13245 Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- This simply escalates an existing TODO in the code base to a ticket. The function `System.IO.hPutBufNonBlocking` [1] calls `hPutBuf'` with `can_block = False`, which is commented as `Bool -- allow blocking?` ([https://github.com/ghc/ghc/blame/876b00ba25a615423f48b0cf9d443a9fd5dbd6f4/li... relevant lines]) However, `hPutBuf'` calls `bufWrite`, inside which there's the comment ([https://github.com/ghc/ghc/blame/876b00ba25a615423f48b0cf9d443a9fd5dbd6f4/li... relevant line]): {{{ if (...) -- There's enough room in the buffer: -- just copy the data in and update bufR. then do ... -- else, we have to flush else do ... old_buf' <- Buffered.flushWriteBuffer haDevice old_buf -- TODO: we should do a non-blocking flush here }}} so it turns out that if there's not enough room in the `Handle` buffer, then `hPutBufNonBlocking` will block. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13247 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC