Skip to content

fix(json-log): EISDIR reads and a worker that fails instead of hanging (4/5 of #66) - #77

Closed
ofriw wants to merge 2 commits into
pr/66-infra-cli-ci-npmfrom
pr/66-jsonlog-worker
Closed

ofriw wants to merge 2 commits into
pr/66-infra-cli-ci-npmfrom
pr/66-jsonlog-worker

Conversation

@ofriw

@ofriw ofriw commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Part 4 of the #66 split: json-log worker durability.

Base is pr/66-codec-storage (#74), not main.

What changed

Directory reads fail with EISDIR. Reading a directory used to return empty bytes on Windows, so a corrupt store looked like an empty file. Deno, Node and OPFS now raise one shared EISDIR identity, which the storage-epoch guard can classify (isNotFound checks name/code).

A dead worker no longer hangs the process. The worker is the only owner of file I/O, so a crashed worker used to leave every pending request unresolved and a DB open never settled. Now:

  • error/exit (Node) and onerror/onmessageerror (browser) call failWorker: log via logging/, reject every pending request with the cause, clear the handle so the next call spawns a fresh worker, terminate best effort.
  • Events from a worker that is no longer current are ignored. terminate() emits exit asynchronously, after a replacement may already be serving.
  • Worker creation and postMessage failures reject the request they belong to.
  • A response with no pending request logs a warning instead of asserting; a worker restart makes that race reachable.
  • failJSONLogWorkerForTests is the test hook.

Verification

  • deno task check clean (including the worker module).
  • Deno 702/702, Node 702/702, browser 406/406.
  • JsonLogWorkerIO covers: the pending read rejects with the worker failure and the next read respawns, EISDIR identity, existing store-open error identity, and that the module logs through logging/ with no console.*.
  • assets.json rebuilt for the changed worker bundle.

Stack

Base #74; sibling of #76.

Stack position

Fourth layer of GitHub stack #80 (main ← #74 ← #75 ← #76 ← #77 ← #78).

@ofriw
ofriw force-pushed the pr/66-codec-storage branch from f21e876 to ceb6c48 Compare October 27, 2026 10:59
@ofriw
ofriw force-pushed the pr/66-jsonlog-worker branch from 4665926 to 71bfb89 Compare October 27, 2026 10:59
@ofriw
ofriw force-pushed the pr/66-jsonlog-worker branch from 71bfb89 to 69d3bfe Compare October 27, 2026 12:09
@ofriw
ofriw changed the base branch from pr/66-codec-storage to pr/66-infra-cli-ci-npm October 27, 2026 12:09
@ofriw
ofriw force-pushed the pr/66-jsonlog-worker branch from 69d3bfe to 6434cde Compare October 27, 2026 12:17
@ofriw
ofriw force-pushed the pr/66-infra-cli-ci-npm branch from 7702032 to 44e22d4 Compare October 27, 2026 12:17
@ofriw
ofriw added this pull request to stack #79 October 27, 2026 12:17
@ofriw
ofriw force-pushed the pr/66-jsonlog-worker branch from 6434cde to cbb6d13 Compare October 27, 2026 12:37
@ofriw
ofriw force-pushed the pr/66-infra-cli-ci-npm branch from 44e22d4 to bfabbea Compare October 27, 2026 12:37
@ofriw
ofriw removed this pull request from stack #79 October 27, 2026 12:38
@ofriw
ofriw added this pull request to stack #80 October 27, 2026 12:38
ofriw added 2 commits October 27, 2026 14:51
A dead worker never answers, so an in-flight request waited forever and a DB
open could hang. Wire the error and exit events (onerror/onmessageerror in the
browser) to fail the worker: log through logging/, reject every pending
request with the cause, drop the handle so the next call spawns a fresh
worker, and terminate best effort. Worker creation and postMessage failures
now reject their own request. A response with no pending request logs a
warning instead of asserting, because a restart makes that race reachable.
@ofriw
ofriw force-pushed the pr/66-infra-cli-ci-npm branch from bfabbea to 32774b3 Compare October 27, 2026 12:53
@ofriw
ofriw force-pushed the pr/66-jsonlog-worker branch from cbb6d13 to 42cd69f Compare October 27, 2026 12:53
@ofriw

ofriw commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by the reviewed, fully verified replacement stack: https://github.com/goatplatform/goatdb/stack/92

Each complete replacement tip passed full Deno + Node + browser suites on current Deno2.9.1 and actual floor2.3.3, with Node24.14.1 and Playwright1.64.1. Exact tip hashes, scope, dependencies, gates and breaking/data notices are in the new PR bodies. Final tip9e9a759f has 0 failures on all six full runs; the 49-source-commit content audit and independent review passed. Remote Actions status is separate from these measured local gates.

Review bottom-up. This replaces the old split, not just its last diff. No PR was merged, no issue was edited, and original remote branches are retained.

@ofriw ofriw closed this Oct 29, 2026
@ofriw
ofriw removed this pull request from stack #80 October 29, 2026 15:14
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