[Git][ghc/ghc][wip/romes/async-rpc] interp: close pipes more promptly
Andrea Vezzosi pushed to branch wip/romes/async-rpc at Glasgow Haskell Compiler / GHC Commits: 174c3078 by Andrea Vezzosi at 2026-11-15T22:29:58+01:00 interp: close pipes more promptly - - - - - 2 changed files: - compiler/GHC/Runtime/Interpreter.hs - libraries/ghci/GHCi/Message/Async.hs Changes: ===================================== compiler/GHC/Runtime/Interpreter.hs ===================================== @@ -668,7 +668,7 @@ stopInterp interp = case interpInstance interp of pure (InterpPending,e) where gracefulShutdown i restore = do - x <- try (timeLimited restore $ sendMessage i Shutdown `finally` closePipe (interpPipe (instProcess i))) + x <- try (timeLimited restore (sendMessage i Shutdown) `finally` closePipe (interpPipe (instProcess i))) let ph = interpHandle (instProcess i) e <- case x of -- happy path: ext. interp. should be shutting down of its own accord. ===================================== libraries/ghci/GHCi/Message/Async.hs ===================================== @@ -598,9 +598,8 @@ drainPipe p unmask = catch loop (void . replyToPendings) where Just q -> writeTQueue q (uq,bs) Cancel uq -> cancelRequest am uq - replyToPendings e = do - atomically $ failPendingReplies p e - pipeCloseRead p `catch` \(_ :: IOException) -> pure () + replyToPendings e = finally (pipeCloseRead p `catch` \(_ :: IOException) -> pure ()) -- TODO: log with verbose. + . atomically $ failPendingReplies p e am = pipeAsyncMngr p @@ -669,8 +668,8 @@ fillPipe p unmask = loop `catch` cleanup Nothing where am = pipeAsyncMngr p - cleanup last_write e0 = do - atomically $ do + cleanup last_write e0 = finally (pipeCloseWrite p `catch` \(_ :: IOException) -> pure ()) -- TODO: log with verbose + . atomically $ do -- deactivate here too so we keep track of the exception if end still 'Open'. s <- deactivatePipeEnd (pipeWriteStatus p) (Just e0) case last_write of @@ -680,7 +679,6 @@ fillPipe p unmask = loop `catch` cleanup Nothing where putTMVar var . Left $ if isOpen s then e0 else toException PipeWriteClosedException -- real exception already reported once failPendingWrites p $ toException PipeWriteClosedException - pipeCloseWrite p `catch` \(_ :: IOException) -> pure () failPendingWrites :: Pipe -> SomeException -> STM () failPendingWrites p e = do View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/174c3078cf373cf95dd670857dc8b3ef... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/174c3078cf373cf95dd670857dc8b3ef... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
Andrea Vezzosi (@trac-Saizan)