Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 196d1def by Duncan Coutts at 2026-07-20T19:44:20-04:00 Mark test T27105 as fragile, citing issue #27522 Scheduler fairness is fine, except when it isn't. And it isn't on CI machines surprisingly often! See the issue for details. - - - - - 2 changed files: - testsuite/tests/concurrent/should_run/T27105.hs - testsuite/tests/concurrent/should_run/all.T Changes: ===================================== testsuite/tests/concurrent/should_run/T27105.hs ===================================== @@ -12,15 +12,19 @@ import Prelude hiding (init) -- Test thread fairness: -- run two cpu-bound threads concurrently for a second, -- each counts how many operations it can perform until signaled to stop --- expect a balance between the two with no more than a 75% imperfection. --- Yes, 75%! On the CI machines we occasionally observe extraordinary levels --- of unfairness: nearly 60% in some cases. We don't want this to become a --- fragile test that is ignored, so we use an extreme bound. This should still --- catch gross breakage. +-- expect a balance between the two with no more than a 30% imperfection. -- --- This _should_ detect if the interval timer is not working, or if thread --- context switching is messed up. We can expect failure if we force a --- contex switch interval of more than half the test time, i.e. more than 0.5s +-- Sadly we have had to mark this test as fragile. On the CI machines we +-- occasionally observe extraordinary levels of unfairness: over 80% in some +-- cases. Having this marked fragile is not ideal, but it's no good having +-- random failures. See issue #27522. +-- +-- People working on the RTS timers, scheduler or capability infrastructure +-- *ought* to check this test is not failing badly in a reproducible way. +-- Doing so should still catch gross breakage. This test _should_ detect if +-- the interval timer is not working, or if thread context switching is messed +-- up. We can expect failure if we force a contex switch interval of more than +-- half the test time, i.e. more than 0.5s. -- -- We run the test twice, with allocating and non-allocating worker threads. -- The -fno-omit-yields above is crucial for worker_nonalloc below, or it never @@ -42,17 +46,16 @@ test worker = do threadDelay 300_000 -- Let them run for 300ms. The default context switch interval is 20ms. -- This gives time for 15 context switches, so this _should_ be enough - -- to get less than 10% unfairness. And on most platforms it is enough. - -- But OSX! Oh OSX! How do I loath thee? Let me count++ the ways. - -- To avoid a fragile test, we use a 75% unfairness threshold. + -- to get less than 10% unfairness. And on most platforms it is enough, + -- but for a bit of robustness we use 30%. putMVar stop () count1 <- takeMVar res1 count2 <- takeMVar res2 let balance :: Double balance = abs ((fromIntegral count1 - fromIntegral count2) / fromIntegral count2) - when (balance > 0.75) $ do - putStrLn "Schedule fairness more than 75% tolerance:" + when (balance > 0.30) $ do + putStrLn "Schedule fairness more than 30% tolerance:" putStrLn $ "imperfection: " ++ show (balance * 100) ++ "%" putStrLn $ "work counts: " ++ show (count1, count2) exitFailure ===================================== testsuite/tests/concurrent/should_run/all.T ===================================== @@ -326,9 +326,10 @@ test('T26341b' , when(arch('wasm32') or arch('javascript'), skip) , compile_and_run, ['-package process']) -# Scheduler (very rough) fairness +# Scheduler fairness test('T27105', [when(arch('wasm32'), skip), # same reason as T367_letnoescape + fragile(27522), run_timeout_multiplier(0.05)], # we expect this to run for ~2s compile_and_run, ['']) test('T27105_fail', View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/196d1def04a9ed1b8f31ca5ccf5a13ba... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/196d1def04a9ed1b8f31ca5ccf5a13ba... 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)
-
Marge Bot (@marge-bot)