Skip to content

[Bug]: Investigate Windows auth worker startup timeout during fixture initialization #202

Closed

Description

@jimhoyd

Runtime revision and environment

PR #194 head 72913bbed67e518bbd1fc1d5c92adc770dc33ab6, tested in GitHub's merge checkout including main's auth 0.1.0-alpha.5 bump. Windows Server 2025, Node 24, windows-2025-vs2026 image 20260907.229.1.

Minimal reproduction

npm run verify:workspaces in the Windows job failed the auth test signup identifier replies do not disclose account existence and mutations require CSRF [primitives] during fixture initialization. openAuthStore hit its existing 15-second startup timer and rejected with auth_store_unavailable; test duration was 17.689s. This is not a failed signup/CSRF assertion. The paired kit variant passed.

Expected: ordinary synthetic fixture initialization completes within the bound. Do not increase production deadlines or remove assertions merely to make CI green. Investigate worker startup latency, scheduling and test concurrency under the hosted Windows load.

Relevant output

https://github.com/jimhoyd-com/urlcode/actions/runs/35483747449/job/106006206085

Timeout._onTimeout ... packages/auth/src/auth-store.ts:130:53, status 503, code auth_store_unavailable.

The previous locked-file cleanup defect is distinct: its original test and deterministic rejected-initialization termination regression both passed in this run. Full local verification and the prior pinned Linux candidate run passed. The startup timeout's cause and reproducibility are not yet established; do not describe it as a proven scheduler defect. Tracked separately from #185's delivered changes.

Activity

  1. jimhoyd commented on Sep 20, 2026

    @jimhoyd
    CollaboratorAuthor

    The subsequent run passed Windows workspace verification in 3m36s: https://github.com/jimhoyd-com/urlcode/actions/runs/35484030531. No startup deadline or test assertion was relaxed. This establishes that the failure is intermittent; it does not identify the cause. Keep this investigation open.

  2. jimhoyd commented on Sep 20, 2026

    @jimhoyd
    CollaboratorAuthor

    Investigated. Not reproduced, and no cause established. PR #218 adds diagnostics only — no deadline raised, no assertion relaxed.

    What the bound covers. The 15s timer starts after new Worker(...) returns, so one bound spans worker thread creation and scheduling, the worker's module load and type-stripping, DatabaseSync opening the file, and the initialization transaction. Nothing distinguished them, which is why the log shows only a timer frame. Separately, 'error' was raced against the timer but 'exit' was not: a worker exiting without an error event would have produced this same opaque 15s timeout.

    Reproduction attempts (macOS, 12 cores). A direct probe of the startup path measured ~50ms warm; 32 concurrent opens peaked at 376ms; the same under 24 saturating CPU processes peaked at 439ms. That is ~34x below the bound, so ordinary contention on this host does not approach it. Not reproduced.

    Concurrency — a real factor, but not shown sufficient. The suite runs node --test test/*.test.ts: sequential within a file, parallel across files at availableParallelism()-1. In the failing job, 456s of summed test time completed in 181s wall — effective parallelism ~2.5 on a 4-vCPU runner, with each test process also running an HTTP server and a store worker thread. So the runner was oversubscribed roughly 2x and the job ran ~10x slower than local (e.g. the neighbouring verified signup registers a real WebAuthn attestation [kit] took 5782ms against 304ms locally). But a uniform 10x does not take a ~50ms startup past 15000ms — that is a tail event of a different order, and it remains unexplained.

    Frequency. Across 56 Windows workspaces jobs in the examined run history, this signature appears exactly once. The other Windows failures in that window are distinct: EBUSY unlink (job 106005433636), EPERM fsync in the backup suite (run 35481500472), and an admin 413 assertion (job 106009880255).

    Ruled out. Not a signup or CSRF assertion failure (fixture initialization). Not database lock contention between tests — each test uses its own mkdtemp directory. Not the port.close() configuration-error path, which posts a message first. Not the 64MB resourceLimits heap cap, which surfaces as an error event.

    Not ruled out. Windows thread scheduling under oversubscription; Defender or cold-FS cost on the worker's module graph; an abrupt worker exit with no error event. #218 is what tells these apart on the next occurrence: it reports whether the thread never began executing or began and then stalled, with the time spent in each, and rejects immediately on failure or exit rather than waiting the bound out.

    Recommendation: leave this open until the instrumented build has run on Windows. There is insufficient evidence to justify any behavioural change to the store.

  3. jimhoyd commented on Sep 20, 2026

    @jimhoyd
    CollaboratorAuthor

    Reopening: #218 merged, but it is diagnostics, not a fix, and closing this on merge would overstate what landed.

    What #218 established:

    • The 15s bound covered four unrelated phases — worker thread creation/scheduling, module graph load and type-stripping, DatabaseSync opening the file, and the schema/configuration transaction — and distinguished none of them. That is why the CI log showed only a timer frame and a status.
    • A separate real gap: worker.once('error', ...) was raced against the timer but 'exit' was not, so a worker that exited without emitting error left the startup promise pending for the full 15s and reported this same opaque timeout. That path is now rejected immediately with its exit code.
    • The deadline is unchanged at 15000 and no assertion was relaxed.

    What it did not establish:

    • The timeout was not reproduced. A direct probe of the startup path measured ~50ms warm serial, 376ms across 32 concurrent opens, and 439ms under 24 saturating CPU processes — roughly 34x below the bound, on macOS.
    • Concurrency is real but not shown sufficient: the failing job showed effective parallelism ~2.5 on a 4-vCPU runner and ran ~10x slower than local, but a uniform 10x does not take a 50ms startup past 15000ms. The tail event remains unexplained.
    • Frequency: one occurrence in 56 Windows workspaces jobs. Other Windows failures in that window were checked individually and are distinct defects (EBUSY unlink, EPERM fsync in backup, an admin 413 assertion).

    Ruled out: a failed signup/CSRF assertion; cross-test database lock contention (each test gets its own mkdtemp); the port.close() configuration-error path; the 64MB heap cap.

    This should stay open until the instrumented build has actually run on Windows and attributed a real occurrence to a phase. #213 was closed as a duplicate of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions