Code RoomConnection close deferred
MediumPrep Room Coding #4282

Connection close deferred

Vibe & agenticCode quality & reviewMid–Senior~16 min

An AI wrote this Go helper to fetch and parse a record from a backend over a pooled TCP connection. It passes tests but the service runs out of file descriptors after a few hours under load. Find the leak, when it triggers, and the fix.

Implement
count_leaked_returns(statements: list[str]) → int
Examples
in[["acquire","write","early_return","read","early_return","defer_close","parse"]]out2
in[["acquire","defer_close","write","early_return","read","early_return"]]out0
in[["dial_error","early_return","acquire","defer_close"]]out0
What 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 16 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.