Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 306120d2 by Duncan Coutts at 2026-07-24T18:05:43-04:00 Fix flaky test T3994 on FreeBSD On current FreeBSD versions, calling getpgid on a zombie process fails. In T3994, if we're really unlucky with delays and scheduling then we can end up in exactly that situation. Just catch that specific exception and ignore it. It's rare, and not our fault. - - - - - 1 changed file: - testsuite/tests/process/T3994.hs Changes: ===================================== testsuite/tests/process/T3994.hs ===================================== @@ -1,7 +1,10 @@ module Main where import Control.Concurrent +import Control.Exception +import Control.Monad import System.IO +import System.IO.Error import System.Process main :: IO () @@ -9,14 +12,24 @@ main = do (_,Just hout,_,p) <- createProcess (proc "./T3994app" ["start", "10000 { std_out = CreatePipe, create_group = True } start <- hGetLine hout putStrLn start - interruptProcessGroupOf p - t <- myThreadId - -- timeout - forkIO $ do - threadDelay 5000000 - putStrLn "Interrupting a Running Process Failed" - hFlush stdout - killThread t - waitForProcess p + + -- On FreeBSD if we're _really_ unlucky with scheduling, then the + -- call to interruptProcessGroupOf can fail due to the process + -- having already terminated (despite it running for at least 10ms!) + -- If so, we just skip doing anything rather than fail the test, + -- since this isn't our fault and is rare and scheduling dependent. + -- See #27512 and https://reviews.freebsd.org/D58393 + handleJust (guard . isDoesNotExistError) (\_ -> return ()) $ do + interruptProcessGroupOf p + t <- myThreadId + -- timeout + forkIO $ do + threadDelay 5000000 + putStrLn "Interrupting a Running Process Failed" + hFlush stdout + killThread t + waitForProcess p + return () + putStrLn "end" return () View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/306120d22191358f227175c2cc3c2e41... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/306120d22191358f227175c2cc3c2e41... 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