Repository navigation
Fix the macOS CI hang: stop restyling the app every 2 s; log check times - #82
Merged
Merged
Conversation
The macOS job on #79 hung after the search window opened and CI killed it at 15 minutes with no clue where: stdout is buffered until the end. Each check now logs its name and time to stderr as it finishes, and faulthandler dumps every thread's stack and exits at 13 minutes.
#76 gave CurrentPageTabWidget a minimumSizeHint that asked every page for its minimum on each call. Layout asks for it on every pass, and a theme change relayouts the whole window, so on CI's macOS runner one check took 338 s and the next hung until the job was killed (the stack dump from the previous commit: sizeHint under apply_theme). _resize_tabs_to_current already gives non-current pages an Ignored vertical policy so they don't count; give them an Ignored horizontal policy too, and drop the override.
With the theme on Auto, a timer calls apply_system_theme every 2 s, and it restyled the whole app each time (app.setStyle, a relayout of every widget) whether or not the system's theme had changed. The app was busy for nothing every 2 s, and on CI's macOS runner a restyle took longer than 2 s, so the next poll came before the last finished and the smoke test never got idle: the hang under apply_theme in the stack dump. It now applies only when the system's theme differs from the last one applied; picking Auto in the menu still applies it right away.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The hang: the macOS smoke job on #79, #81 and #82 printed nothing after a point and was killed at CI's 15-minute limit. A passing run had a 100 s gap in the same place.
Finding it (first commit): each
check_*now logs its time to stderr, andfaulthandlerdumps every thread's stack at 13 minutes. The dump showed the main thread underthemes.apply_theme, called fromapply_system_theme.Cause: with the theme on Auto, a timer polls the system theme every 2 s. Each time,
apply_system_themecalledapply_theme, and soapp.setStyle(), which restyles and relays out every widget, even when nothing had changed.Fixes:
apply_system_themeapplies only when the system theme differs from the last one applied. Picking Auto in the menu still applies it right away (force=True).minimumSizeHint, which asked every page on every layout pass, is replaced by the existing_resize_tabs_to_currenthook. It now sets non-current pages to Ignored horizontally as well as vertically: same result, no per-call cost.Tests:
check_theme_poll: three polls with no change apply the theme once, and a change applies it again.