Track work on a dedicated backtracing article in server-guides. The current packaging article gets a minimal note about copying swift-backtrace-static into runtime images, with a link here for the broader topic.
Scope
A standalone article covering how to get useful crash traces from Swift services on Linux:
- Why the backtracer matters in slim/distroless container images.
- Copying the static backtracer (
swift-backtrace-static) into a runtime image.
- Frame-pointer history:
-Xcc -fno-omit-frame-pointer was needed in older Swift releases; the toolchain has been emitting frame pointers by default since Swift 5.10, so the flag is generally no longer required.
- Static Linux SDK considerations — the backtracer's interaction with
process_vm_readv, kernel Yama policies, and musl's clone() semantics has produced real-world breakage on the static SDK.
- Backtracing in unusual environments — running as pid1 with no userland; newer container runtimes that don't expose
process_vm_readv.
Known issues fixed upstream
- Static SDK + musl:
clone() returning EINVAL for CLONE_THREAD broke backtraces on the 6.1 static SDK. Fixed in swiftlang/swift#82633; shipped in the 6.1.3 release and 6.2.
Origin
Originally listed as a bullet ("Enabling backtracing (simple example)") in the packaging migration outline (#17) but didn't make the merged article (#71). Splitting it out as its own article keeps the packaging guide focused on container packaging while giving backtracing the room it actually needs.
Track work on a dedicated backtracing article in
server-guides. The current packaging article gets a minimal note about copyingswift-backtrace-staticinto runtime images, with a link here for the broader topic.Scope
A standalone article covering how to get useful crash traces from Swift services on Linux:
swift-backtrace-static) into a runtime image.-Xcc -fno-omit-frame-pointerwas needed in older Swift releases; the toolchain has been emitting frame pointers by default since Swift 5.10, so the flag is generally no longer required.process_vm_readv, kernel Yama policies, and musl'sclone()semantics has produced real-world breakage on the static SDK.process_vm_readv.Known issues fixed upstream
clone()returningEINVALforCLONE_THREADbroke backtraces on the 6.1 static SDK. Fixed in swiftlang/swift#82633; shipped in the 6.1.3 release and 6.2.Origin
Originally listed as a bullet ("Enabling backtracing (simple example)") in the packaging migration outline (#17) but didn't make the merged article (#71). Splitting it out as its own article keeps the packaging guide focused on container packaging while giving backtracing the room it actually needs.