Skip to content

GUI: open the window before the startup SNTP sync - #95

Merged
sidick merged 1 commit into
mainfrom
71-sntp-after-window
Jul 21, 2026
Merged

sidick merged 1 commit into
mainfrom
71-sntp-after-window

Conversation

@sidick

@sidick sidick commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Addresses the parked symptom in #71 — "passphrase requester closes, then no window appears" — with a root cause, a deliberate on-target reproduction, and a fix. (Not closing #71 automatically; see below for what remains of it.)

Root cause

The startup SNTP sync sat between the passphrase requester and win_show, and it can block far longer than the nominal 5 s UDP timeout: clock_sntp_sync calls gethostbyname(), whose timeout belongs to the TCP/IP stack's resolver, not us — against a dead/black-holed DNS server that's routinely tens of seconds. With a stack running but the network down (a typical Amiberry test-session state), the requester closed and then nothing appeared until the resolver gave up. This also explains why the symptom "hasn't been seen recently": no stack configured → bsdsocket open fails instantly → sync skips.

This displaces the parked LISTBROWSER-relist theory: the first relist paints ------ placeholders (cheap); the network block was sitting directly in the reported gap.

Reproduction (deliberate, on-target)

Two instrumented builds with an identical 30 s Delay() injected at the sync call site, run through gui-smoke's window assertion with the screenshot at t=35 s:

  • Old ordering + stall: bare desktop, unique_colours=1 — the reported symptom, verbatim.
  • New ordering + same stall: window up and painted (placeholders in the code column, amber "Clock: manual" status), stall running behind it.

The fix

Move the sync to right after win_show (and refresh the status line + LED immediately on success rather than waiting for the next tick). Worst case is now a visible, briefly unresponsive window instead of an invisible hang. Placement detail: the sync stays before the public-port AddPort, so a CLI launched during a slow sync falls back to its local path exactly as before — registering the port earlier would instead make forwarded requests block on the unserviced port.

A fully async sync (subprocess) would remove even the brief unresponsiveness, but that's real machinery for a window that's normally sub-second; noted as a possible future refinement.

What this does and doesn't settle in #71

Verified

make test (194), make gui-smoke (normal, non-instrumented), mkdocs build --strict + make guide clean. Docs updated in-branch: Troubleshooting gains "window ignores clicks briefly after unlocking", Time-and-Clock-Sync notes the new ordering.

🤖 Generated with Claude Code

The startup sync ran between the passphrase requester and win_show, and
it can block for a long time: gethostbyname() has no timeout under our
control (a dead resolver can hang it for tens of seconds) plus up to 5s
of UDP wait. With a TCP/IP stack up but the network dead, the requester
closed and then nothing appeared - the parked "unlock then no window"
symptom from #71, which reads as a crash.

Reproduced deliberately under Copperline with a 30s stall injected at
the sync site: old ordering shows a bare desktop at t=35s (gui-smoke's
window assertion fails), new ordering has the window up and painted with
the stall running behind it. The window is briefly unresponsive during
a slow sync (amber/red LED, "------" codes) and the status line + LED
refresh the moment the sync returns. CLI-forwarding semantics are
unchanged: the public port still registers after the sync, so a CLI
launched meanwhile falls back to its local path exactly as before.

Docs: Troubleshooting gains a "window ignores clicks briefly" entry
(replacing the invisible-hang failure mode); Time and Clock Sync notes
the sync now happens right after the window opens.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sidick
sidick merged commit 1087fc6 into main Jul 21, 2026
7 checks passed
@sidick
sidick deleted the 71-sntp-after-window branch July 21, 2026 19:08
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