Back to Swift
GSoC 2026

Task and TaskGroup Tracking for Swift Concurrency

Swift's concurrency runtime has no mechanism to enumerate live Tasks and TaskGroups. When a program using async/await stalls, existing tools such as thread backtraces, Instruments, LLDB are silent about the suspended tasks that are the likely cause. Instruments records task lifetimes after completion; there is no API, debugger command, or crash report field that answers "what tasks exist right now and what are they waiting on?" This project implements a global registry of live AsyncTask and TaskGroup instances inside the Swift Concurrency runtime. The core challenge is doing this without introducing unacceptable synchronisation overhead on every task creation and destruction, a hot path in any concurrent Swift program. I will implement and benchmark at minimum two candidate data structures: a sharded-mutex intrusive list (using PrivateStorage, which is opaque externally and safe to extend without breaking ABI) and a lock-free Treiber stack alternative. Deliverables: A working registry implementation with hooks in swift_task_create_commonImpl and AsyncTask::~AsyncTask() A design document comparing candidate data structures with measured overhead against the existing TaskGroups.swift and AsyncTree.swift benchmark suite Signal-safe crash backtrace integration listing live tasks on crash LLDB Python macros for interactive task inspection.

Project details

Contributor

Ege Kaya

Mentors

Not available

Technologies

Not listed in the archive