ReviewOS

stacks/stx

Bound concurrent SSR work and queued page renders

#2136
Closed chris opened this 4 days ago ·
4 days ago

ReviewOS's production web service is being killed at its unchanged 2 GiB memory limit while roughly 175 web connections overlap. A 30-second JSC profile places the work in STX page rendering (directives, loops, interpolation, components and CSS); active render contexts accumulate while slow queries await. The Git proxy shares this web process, so a web OOM also truncates checkouts used by HQ's macOS acceptance jobs.

Bound concurrent page rendering and its waiting queue in the framework, before creating template contexts. Respect queued request cancellation and waiting deadlines, always release slots after failures, and return an uncached 503 with Retry-After when full. Existing API hooks, Git proxy traffic and static assets should remain outside the render admission gate. Queued requests must retain their own cookies and parameters.

Acceptance: actual HTTP regression covering static and dynamic renders, capacity refusal, cancellation/timeout, error recovery and request isolation; normal published package consumption; production memory and normal clone verification. This is a render capacity safeguard; the separately identified highlighted-code retention fix does not establish that all memory growth is resolved.

Related: https://github.com/ReviewOS/reviewos.org/issues/8 Related: https://github.com/stacksjs/hq.training/issues/346 Related: https://github.com/stacksjs/hq.training/issues/366 Related: https://github.com/stacksjs/hq.training/issues/368

4 days ago

Implemented on main in https://github.com/stacksjs/stx/commit/8aaba3ddf31f112b292af1b662f2eed62eb90d12 and tagged through normal bun run release:patch as v0.2.746 (https://github.com/stacksjs/stx/commit/8a2e63fb0796515d9b02b5294edc66ebeb359ff0).

Each bun-plugin-stx server now defaults to four active page renders, 32 waiting requests and a 15-second queue deadline. Static and dynamic pages plus async component fragments share admission. API hooks and static files bypass it. Full/expired queues produce an uncached 503 with Retry-After; aborted queued requests never run, and disconnected active work retains its slot until it finishes.

Validation: actual HTTP regression red before implementation; five checks pass on production/CI Bun 1.4.2, including request identity, timeout, cancellation, active disconnect and validation-failure recovery. Related route context, render cache, warm-up and strict failure regressions: 44 pass. Type checking and plugin build pass, generated declaration includes the public options, format check is clean. Full lint has zero errors and 254 existing explicit-any warnings; the new admission module has zero warnings.

Publication and consumer deployment are pending the normal release gates. This issue remains open until published consumption and production verification.

4 days ago

Published STX 0.2.746 is now consumed by ReviewOS at https://github.com/ReviewOS/reviewos.org/commit/8b05734e8a8570df3e8fe3105131bb5442b89b9a and HQ at https://github.com/stacksjs/hq.training/commit/c2d6b80b28ddfd725a6c478c53a2cf12dcb69285. No dependency patch or source link is used.

ReviewOS validation on pinned Bun 1.4.2: lint/types clean; 107 focused cache/highlight/Git/URL checks pass. The installed normal serve entry, against a framework-owned disposable PostgreSQL database with real migrations, rendered the public homepage and canonical clone link; eight concurrent public requests returned 200. Normal full ReviewOS CI has passed both database suites and is deploying: https://github.com/ReviewOS/reviewos.org/actions/runs/40919521264.

Production memory/Git acceptance remains open at /reviewos/reviewos.org/issues/8. Memory and runner admission guards remain unchanged, and all temporary production profiling is removed.

4 days ago

Delivered through the shared source and normal published dependencies:

  • SSR admission, queue capacity/deadline, cancellation and recovery: https://github.com/stacksjs/stx/commit/8aaba3ddf31f112b292af1b662f2eed62eb90d12, published as STX 0.2.746.
  • ReviewOS consumes the complete published cohort and its byte-bounded highlighting cache: https://github.com/ReviewOS/reviewos.org/commit/8b05734e8a8570df3e8fe3105131bb5442b89b9a. The normal source CI and production deployment passed: https://github.com/ReviewOS/reviewos.org/actions/runs/40919521264.
  • Two rounds of eight concurrent public homepage/docs/explore/repository requests passed HTTP 200. Four concurrent real source-file pages also passed HTTP 200, including highlighted Git and highlighting-pool source.
  • Fresh ordinary shallow clones from the canonical Git endpoint passed git fsck --no-reflogs before and after an external managed service restart. Both resolve to the expected deployed source. No transport overrides or retry loops were used.
  • The first process held near 959 MiB through its observation interval before an external managed stop/restart at 17:43 UTC; that was not an OOM and was not initiated by this work. At 17:55:54 UTC the replacement process is active, NRestarts=0, current memory 795,762,688 bytes and peak 1,111,916,544 bytes, below the unchanged 2,147,483,648-byte limit. Neither observation interval recorded an OOM. This is bounded acceptance evidence, not an indefinite uptime guarantee.
  • Temporary diagnostic preload files and service overrides were removed. No scheduled collection, memory-limit increase or forced restart remains.

The application passed 107 focused regressions, full types and strict lint before deployment. The roadmap acceptance and deployment references are recorded at https://github.com/ReviewOS/reviewos.org/commit/92dc4a23; its 10 roadmap checks and full strict lint pass.

The independent LSU UIKit/voice acceptance remains open at /stacks/hq.training/issues/318. Its Mac jobs are currently waiting on disk admission, not a claimed native pass.

Sign in to comment on this issue.