Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

~Actor<O> is blocking #2644

Closed
Closed

Description

@kkaefer

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.

/cc @jfirebaugh

Activity

  1. changed the title [-]WorkTask blocks cancellation[/-] [+]WorkTask cancelation is blocking[/+] on Oct 16, 2015
  2. jfirebaugh commented on Oct 16, 2015

    @jfirebaugh
    Contributor

    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.

  3. jfirebaugh commented on Oct 20, 2015

    @jfirebaugh
    Contributor

    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.

  4. tmpsantos commented on Jan 25, 2016

    @tmpsantos
    Contributor

    This is by design.

    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.

  5. kkaefer commented on Apr 15, 2016

    @kkaefer
    MemberAuthor

    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:

    1. Make tile parsing cancellation non-blocking. This means that parsing a tile must not access resources shared with the main thread or other threads.
    2. Refactor our landuse layer to avoid single polygons that are too complex

    /cc @mourner

  6. added
    performance
    Core
    on Apr 21, 2016
  7. jfirebaugh commented on Sep 16, 2016

    @jfirebaugh
    Contributor

    As of #6337 there's no cancellation of tasks, but destroying the actor can still block. We need #667 in order to remove that.

  8. changed the title [-]WorkTask cancelation is blocking[/-] [+]~Actor<O> is blocking[/+] on Sep 16, 2016
  9. jfirebaugh commented on Apr 27, 2017

    @jfirebaugh
    Contributor

    It should be safe to change this now.

  10. added
    archived
    on Nov 7, 2018
  11. stale commented on Nov 27, 2018

    @stale

    This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Corearchivedperformance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions