You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
When canceling a WorkTask, we block until that task has completed its entire invocation. This isn't something we should do. You can make this behavior more visible when adding a sleep(4) in a worker task, (e.g. in TileWorker::parse()). Panning fast now stalls heavily, as partial work requests are getting canceled.
This is by design. WorkTasks typically have references to objects which need to outlive the task, whose owner is in turn owning the task. If the task isn't canceled, then these lifetime invariants will not hold: the objects will be destroyed along with their owner, while the work task will continue running with dangling references.
Worker tasks should be designed to check a flag in inner loops and exit early if the flag indicates the task has been cancelled. Most do; the exception I see is SymbolBucket, which has no early exit for the loops in needsDependencies and addFeatures.
And I like the design here because protects us from bugs that are very difficult to debug that haunted us in the past. On #3636 suggested a special deleter for TileData that if turns out to be needed somewhere else we could make it more generic and call it NonBlockingDeleter and have a method like ::willBlockOnDestructor() to postpone the deletion on objects with WorkRequests.
This is resurfacing: When parsing tiles, we're checking a flag after parsing every feature whether we still need the tile. However, our landuse layer, in particular on zoom level 7, contains some very complex features that take > 1 second to parse in their call to clipper + libtess2. These tasks are not interruptible. We should do two things:
Make tile parsing cancellation non-blocking. This means that parsing a tile must not access resources shared with the main thread or other threads.
Refactor our landuse layer to avoid single polygons that are too complex
Activity
[-]WorkTask blocks cancellation[/-][+]WorkTask cancelation is blocking[/+]jfirebaugh commentedon Oct 16, 2015
This is by design.
WorkTasks typically have references to objects which need to outlive the task, whose owner is in turn owning the task. If the task isn't canceled, then these lifetime invariants will not hold: the objects will be destroyed along with their owner, while the work task will continue running with dangling references.jfirebaugh commentedon Oct 20, 2015
Worker tasks should be designed to check a flag in inner loops and exit early if the flag indicates the task has been cancelled. Most do; the exception I see is
SymbolBucket, which has no early exit for the loops inneedsDependenciesandaddFeatures.tmpsantos commentedon Jan 25, 2016
And I like the design here because protects us from bugs that are very difficult to debug that haunted us in the past. On #3636 suggested a special deleter for
TileDatathat if turns out to be needed somewhere else we could make it more generic and call itNonBlockingDeleterand have a method like::willBlockOnDestructor()to postpone the deletion on objects withWorkRequests.kkaefer commentedon Apr 15, 2016
This is resurfacing: When parsing tiles, we're checking a flag after parsing every feature whether we still need the tile. However, our landuse layer, in particular on zoom level 7, contains some very complex features that take > 1 second to parse in their call to clipper + libtess2. These tasks are not interruptible. We should do two things:
/cc @mourner
jfirebaugh commentedon Sep 16, 2016
As of #6337 there's no cancellation of tasks, but destroying the actor can still block. We need #667 in order to remove that.
[-]WorkTask cancelation is blocking[/-][+]~Actor<O> is blocking[/+]jfirebaugh commentedon Apr 27, 2017
It should be safe to change this now.
stale commentedon Nov 27, 2018
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.