Skip to content

Async cancellation can be overwritten by a running task #3233

Description

@dajiaohuang

In cpp/async/handle_base.hpp, cancel() marks an unresolved result as cancelled under the spin lock. If a bg_queue_promise task has already passed its initial cancellation check and is running, its later set_value()/set_exception() replaces the cancelled optional result without checking is_cancelled(). The promise can then report a successful completion after cancel() returned true (while the callback was cleared). The tracked path is async::run_on_main/run_on_bg -> run_ -> bg_queue_promise::call -> handle_base setters; run_on_main has production callers in deeplake_api/dataset.hpp and deeplake_pg/table_data_impl.hpp. A narrow source candidate guards completion setters against replacing cancellation. No tests/builds were run.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions