Repository navigation
fix(geotiff): reject decodes when the decoder worker fails - #771
Merged
kylebarron merged 3 commits intoOct 22, 2026
Merged
Conversation
WorkerWrapper only listened for `message`, so a worker that failed to load (e.g. a bundler serving the wrong worker URL) or threw outside a job never replied, and every DecoderPool.decode() promise stayed pending forever. Tiles were fetched but never rendered, with no error. Listen for `error`: reject the wrapper's pending jobs and remember the failure so jobs submitted afterwards reject too, since a failed load usually fires before the first tile is decoded. Co-Authored-By: Claude Opus 5.5 <[email protected]>
kylebarron
reviewed
Oct 22, 2026
The old comment stated the outcome ("never the least loaded") without
saying how `jobCount` causes it. Document the getter instead: the pool
sends each decode to the worker with the fewest jobs, so reporting
`Infinity` keeps a failed worker last until every worker has failed.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…load A worker can keep running after an uncaught error, but the pool never sends it another job, so terminate it rather than hold its thread and memory for the life of the pool. Terminating a worker that failed to load does nothing. Browsers fire a plain `Event`, with no message, only when the worker script fails to load (404, wrong MIME type, failed import), so say "failed to load" in that case instead of a bare "failed". Also document on `DecoderPool.decode` that it now rejects when its worker fails. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This PR was written by Claude (Claude Code), not by @charlieforward9.
If the decoder worker fails to load (e.g. Vite pre-bundling moves
worker.js, as in #364) or throws outside a job,WorkerWrappernever hears about it, so everyDecoderPool.decode()stays pending: COGLayer tiles are fetched but never render, with no error.WorkerWrappernow listens forerror, rejects that worker's pending and later jobs, and is no longer picked while another worker still works. The newtests/pool.test.tsfails without the change.