The hunt for the Task canceller

Hello,

I have a Task that gets cancelled somewhere, and I'd like to find where, because it should not happen :sweat_smile:

  • A breakpoint in the cancellation handler of withTaskCancellationHandler does not reveal the canceller in the stack trace.

    And I don't know how to instruct lldb to print the stack trace without the fancy async reconstruction.

  • A symbolic breakpoint on Task.cancel() does not catch anything.

  • A symbolic breakpoint on UnsafeCurrentTask.cancel() does not catch anything.

  • A breakpoint of Swift errors catches CancellationError, but this is too late.

I suppose there is a low-level function that I should put a symbolic breakpoint on, but I don't know its name.

Has anyone a clue? Thanks in advance!

1 Like

swift_task_cancelImpl does it for me :slight_smile:

11 Likes

Woot! Thank you :partying_face: :pray:

OK this is a task cancelled by SwiftUI, now I can focus my debugging :-)

1 Like