Ray's Knowledge Base
Unlock

GCC 12.1 x86_64 traps (SIGILL) on if (co_await f()); name the awaited result first

PitfallVerified 13 Oct 2026Holds anywhere
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.

Symptom#

dftracer_view crashed with SIGILL on corona (GCC 12.1.1, x86_64), even on a 1 MB file. The same code ran fine with GCC 12.3 on aarch64 and with Clang. gdb with disassemble /s showed a ud2 trap at the start of the function's cold block.

Cause#

In try_serve_aggregate_no_scan (src/dftracer/utils/trace/views/view_executor.cpp), a call was awaited inside an if condition: if (co_await try_collect_bootstrap(plan, out)). GCC 12.1 on x86_64 compiled one path of that into a trap. A capturing lambda was suspected first but was not the cause.

Fix#

Store the awaited result in a named variable, then test the variable. The export path (around line 306) had the same pattern and got the same fix. Also add the rule 'name an awaited result before you test it' to coroutine-caveats.rst.

Evidence#

After the fix, dftracer_view on s0-part0 (131 runs, 23,075 func, 4,905,256 counter records) matched an independent Python count. 55 view tests passed locally. No test catches this in CI, because neither CI compiler (GCC 11 and 12.3) produces the trap. It shows only with GCC 12.1. Do not guess the cause from a lambda or a frame-lifetime theory: replacing the capturing lambda with a named coroutine left the crash in place.