Async send buffer lifetime
An AI wrote this C++ async-send code for a network engine: it queues a send and returns immediately. It works in single-threaded tests but crashes intermittently under load with corrupted bytes on the wire. Identify the memory/lifetime bug, the timing that triggers it, and the fix.
Implement
count_lifetime_violations(events: list[str]) → intExamples
in
[["alloc:1","submit:1","free:1","complete:1"]]out1in
[["alloc:1","submit:1","complete:1","free:1"]]out0in
[["alloc:1","submit:1","complete:1","free:1","alloc:2","submit:2","free:2"]]out1What a strong answer looks like
Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.
0:00 of about 22 min
Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.
Run or narrate your approach, then ask the coach.