You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Fixed
A memory gate for a large Sky.Spa build (#350). Two new tests measure the
build of a synthetic large Sky.Spa app (xtask bench-gen --spa: a Model of
N fields, N update arms, nested aliased records, a returned scroll and
whole-model server arms that fold the model with List.foldl). spa_split_front_end_memory runs the parent check, the split and both legs'
front ends in one process and records the peak heap of each phase at three
sizes against a checked-in baseline. It also records how the type layer's
work grows (a new uf_slots counter counts the union-find slots), so each
later fix can assert the growth it makes linear. spa_build_tree_peak builds the app with 1400 fields for --target web:app
and bounds the resident memory of the whole process tree (sky, both legs
and every Go tool) at 3.3 GB, the measured peak plus 15%, so a rise of 20%
fails. The synthetic app is heavier per field than before (a field four
aliased records deep, audit arms that read the whole model, 16 modules), so
its leg sky processes now take 2.2 to 2.7 GB, nearer the 3.5 GB of the
production app. The release workflow runs it alone in the new gate-build-memory job.
A Sky.Spa build no longer lowers the whole app before it splits it
(#350).sky build of a Spa.app entry, and sky build --target web:app
(or another client target) of a Std.App entry, checked the app with the
whole front half, Go emit included, and then threw that Go away: each leg
lowers the project it builds. The build now stops at the checked program
before the split. On the large production app of #350 that lowering raised
the parent's peak memory from 1.5 GB to 3.2 GB. An error that only the lowering
finds (for example a call into a Go package with no generated FFI surface)
is still reported once, at your own source line, with the same text, by sky check and sky build alike: when a leg or the split fails, the build
checks the whole app again and reports its error first.
sky check of a Sky.Spa app checks what sky build builds (#356). sky check of a Spa.app entry, or of a Std.App entry with a client
target (web:app, mobile:ios, …), lowered and go build-ed the app
unsplit, which the build no longer does. An error found only there failed
the check and passed the build, and an error in a leg failed the build and
passed the check. Now sky check runs the steps the build runs: the checked
front half, the split (in a private directory, or .skyapp/check-<target>/
for a Std.App entry), then sky check in each leg, with no packaging. It
gives the same verdict and the same error lines as sky build. It prints
the split's warnings and one No errors found., not the split report.
A trial unification no longer copies the whole type store (#350). The
type checker takes a snapshot of its store before a step it may undo. The
snapshot now shares the store in chunks and copies only a chunk that is
written after it. On the synthetic large Sky.Spa app the slots copied fall
by two thirds (241k to 81k in the backend leg). Two new counters, uf_clones and uf_copied, show it in SKY_TIMINGS=1.
A ground type is held once, not node by node (#350). When the checker
uses a type with no type variable in it (a record of 300 fields, a List ( Int, String )), it keeps the whole type as one shared descriptor
and gives a node its own storage only when it reads or changes that node.
Before, only a record constructor's type was held this way. Types, errors
and the generated Go are the same as before: a test runs every corpus both
ways and compares them, and a random test compares the two forms under
unification, snapshots and rollback. The counter uf_frozen shows how many
nodes are held this way (about 90% in the synthetic app's backend leg).
A Sky.Live page that is leaving keeps the navigation you started. When
a sky-nav link or a Nav.pushUrl / Nav.replaceUrl page fetch failed,
the client loaded that URL as a full page. Safari cancels a fetch in flight
when a page starts to unload, so a person who followed a plain link, typed
an address or sent a form while a server navigation was in flight was taken
to the server's URL instead. Now the client does not load the page while
the page is leaving. If the page stays (a download, a 204 answer), it loads
it when the leaving window ends, as before. A page load the client starts
itself (the fallback of a failed sky-nav fetch, which may be a download)
does not count as leaving, so the next failed navigation still falls back
at once.
A Sky.Live session with a Sub.every now expires. Each tick saved the
session through the store, and the save slid the session's TTL, so a
session with a ticker never expired. Every closed tab kept its Model, its
ticker and its SSE relay goroutine for the life of the process, and the
tickers of the closed tabs kept the CPU busy (the new leak gate measured
two goroutines per closed session and 10% of a core while idle, after 60
sessions). Now only a request from the client, and the heartbeat of an
open SSE stream, slide the TTL. A model change the server makes on its own
(a tick, a topic or source message, a Cmd.perform result) is saved
without it, on every session store. On Redis such a save keeps what is
left of the key's TTL.
An open Sky.Live tab keeps its session under a short TTL. The SSE
heartbeat, which slides the TTL of an open tab, ran every 15 s whatever the
TTL. Under a TTL shorter than that (SKY_LIVE_TTL=10s), the reap expired a
tab that was open and connected between two heartbeats, once a Sub.every
tick no longer slid the TTL. The heartbeat now runs every third of the TTL
when that is shorter than 15 s (never more often than every 100 ms).
An expired Sky.Live session is reaped within about one TTL. The
session reap ran every 60 seconds whatever the TTL, so a session with a
short TTL stayed in memory for up to a minute after it expired. The reap
now runs every half TTL when the TTL is under two minutes, and never more
often than once a second.
Added
A memory and CPU leak gate in CI (xtask leak-gate, docs/tooling/leak-gate.md). Six small built Sky apps under tests/leak/
(Sky.Live with a ticker, a Sky.Spa backend, an HTTP API, WebSocket plus
SSE, a Task worker, and Std.Cache with pub/sub fan-out) go through many
session cycles with traffic and reconnects. After load stops and a forced
GC, goroutines and open files must return to the baseline, the live heap
must stop growing, and idle CPU must stay under 2% of one core (CPU time
and open files are read from the OS). A short form runs on every commit (a
need of ci-green), a longer form in the release suite (gate-leak) and
a long soak in the nightly. The gate reads the goroutines and the heap
from a test-only probe, /_sky/leak-probe: it is mounted only when SKY_LEAK_PROBE_TOKEN holds a token of at least 32 bytes, never in
production, and it needs that token as a bearer token.