fix: preserve shared earcut worker pool - #1248
Closed
MarkusTomio wants to merge 1 commit into
Closed
Conversation
Member
|
Thanks for the issue/PR! This is indeed a bug.
I think this is the core problem. Here we see override async finalizeState(_context: LayerContext): Promise<void> {
await this.state?.earcutWorkerPool?.terminate();
console.log("terminated");
}while actually the Let's create an issue there instead |
Member
|
I created geoarrow/deck.gl-geoarrow#218. @MarkusTomio would you be interested in making a short PR there? Then we can release a new version of deck.gl-geoarrow and a new version of lonboard using it. |
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.
This PR fixes an issue where recreating a polygon layer can terminate Lonboard's shared Earcut worker pool.
Lonboard passes one shared pool to the GeoArrow polygon layers. When a layer is disposed,
GeoArrowSolidPolygonLayer.finalizeState()callsterminate()on the supplied pool.GeoArrowPolygonLayeris affected as well because it passes the pool to itsGeoArrowSolidPolygonLayerfill sublayer. Subsequent polygon layers fail to queue triangulation work, because Lonboard reuses that same pool:Cannot schedule pool tasks after terminate() has been calledI ran into this when rerunning a SolidPolygonLayer in Marimo: the first render worked, but recreating the layer caused the polygon fill to disappear until the page was reloaded. I could not reproduce the same behavior with the minimal example in JupyterLab.
Before
After
The change keeps the actual pool owned by Lonboard and exposes a wrapper that forwards the normal pool operations while making terminate() a no-op. This keeps the shared-pool behavior and prevents an individual GeoArrow layer from shutting it down.
Tested on current main (0.17.0-beta.1):
This fixes the issue on the Lonboard side. It may also be worth addressing the underlying ownership behavior upstream in GeoArrow.