Expand description
Process-parallel page rendering for pass B of the post pipeline
(docs/archive/STREAMING_POST_DESIGN_2026-07-06.md §6).
In-process page threads are blocked twice (ObjectDB is !Send;
libxslt serializes every transform behind a process-wide lock), so the
chosen shape is process-level page-range workers: the parent saves the
completed ObjectDB as a SQLite file, partitions the spilled pages into
contiguous chunks, and re-invokes its own binary once per chunk with
LATEXML_RENDER_WORKER=<manifest.json>. Each child attaches the db
readonly (WAL — N readers share one page cache via mmap), runs the SAME
per-page pipeline as the serial driver
(crate::post::render_spilled_page), and reports its diagnostic tally
as trailing Status: lines on stderr. The parent folds child logs and
counts deterministically, in chunk order, into its own LOG_BUFFER /
REPORT — so the combined verdict and the persisted --log stay lossless
(canvas signal-integrity rule: a child that dies without a status line is
never taken for success).
Env knob: LATEXML_RENDER_JOBS (usize; 1 = the serial path). Unset, the
latexml_oxide binary renders a split of MIN_PAGES_FOR_PARALLEL pages
or more on min(available cores, AUTO_JOBS_MAX) workers; every other
embedder (the library, cortex_worker) stays serial. The pages are
byte-identical either way (the parent names every page’s images before the render and
the workers look the names up, issue 995); a worker that fails to spawn, cannot set up, or
dies without its status report sends the whole document back to the serial
render at once, stopping the rest of the fleet (an Info; a Warning for a
worker killed by a signal, a crash).
Structs§
- PageJob
- One spilled page for a worker to render: the spill path plus the metadata
that does not survive the XML round-trip (mirrors
post::SpilledPageminus the parent-only placeholder flags). - Page
Opts - The serializable subset of
PostDocumentOptionsa worker needs to reconstruct the page parse — ALL of its fields, since evendestination(later overridden per page) feeds the site-directory fallback insidePostDocument::new. - Render
Manifest - Everything a page-render worker needs to rebuild the pass-B processor set
exactly as the parent would have, plus its page range. Written as
render-manifest-{i}.jsonbeside the savedLaTeXML-render.db.
Functions§
- enable_
auto_ jobs - Let an unset
LATEXML_RENDER_JOBSpick the fleet size (render_jobs). - worker_
main - Entry point of the hidden worker mode (
LATEXML_RENDER_WORKER=<manifest>), dispatched from the binary’smainbefore any CLI handling. Renders the manifest’s page range and ends its stderr with the status report, or with the setup-failure line when it could not start, so the parent never mistakes a broken worker for a clean one.