Skip to content

Fix the macOS CI hang: stop restyling the app every 2 s; log check times - #82

Merged
gahingwoo merged 3 commits into
mainfrom
ci/smoke-timing
Oct 30, 2026
Merged

gahingwoo merged 3 commits into
mainfrom
ci/smoke-timing

Conversation

@gahingwoo

@gahingwoo gahingwoo commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

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, and faulthandler dumps every thread's stack at 13 minutes. The dump showed the main thread under themes.apply_theme, called from apply_system_theme.

Cause: with the theme on Auto, a timer polls the system theme every 2 s. Each time, apply_system_theme called apply_theme, and so app.setStyle(), which restyles and relays out every widget, even when nothing had changed.

  • In the real app this meant a whole-window relayout every 2 s while idle.
  • On CI's slow macOS runner one restyle took longer than 2 s. The next poll was due before the last one finished, so the event loop never got idle and the test hung.

Fixes:

  • apply_system_theme applies only when the system theme differs from the last one applied. Picking Auto in the menu still applies it right away (force=True).
  • Open search in its own window; keep the tabs within the window #76's minimumSizeHint, which asked every page on every layout pass, is replaced by the existing _resize_tabs_to_current hook. It now sets non-current pages to Ignored horizontally as well as vertically: same result, no per-call cost.

Tests:

  • New check_theme_poll: three polls with no change apply the theme once, and a change applies it again.
  • Full smoke run passes locally.
  • This PR's macOS CI run is the real test.

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.
@gahingwoo gahingwoo changed the title smoke: log each check's time; dump stacks before CI's timeout Fix the macOS CI hang: size tabs by the current page cheaply; log check times Oct 30, 2026
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.
@gahingwoo gahingwoo changed the title Fix the macOS CI hang: size tabs by the current page cheaply; log check times Fix the macOS CI hang: stop restyling the app every 2 s; log check times Oct 30, 2026
@gahingwoo
gahingwoo merged commit 51dfce5 into main Oct 30, 2026
5 checks passed
@gahingwoo
gahingwoo deleted the ci/smoke-timing branch October 30, 2026 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant