Switching views hangs when slow long-poll fetches hold all 6 browser connections: unload the old iframe before the next request
Symptom: a single-page app embeds a viewer in an iframe that issues slow POSTs to the same origin (each can take minutes on a cold backend). The user picks another item; the app POSTs to create the new session and only afterwards DELETEs the old one. The UI hangs on the loading label. Cause: HTTP/1.1 allows about 6 connections per origin in Chrome, and the old iframe still holds them with pending fetches. The new POST and the old-session DELETE queue behind them, and the server never learns the old work is abandoned, so its backend worker keeps running.
Fix (client only): before the new request, set iframe.src = "about:blank". Unloading the document aborts all its in-flight fetches and frees the connections. Then fire the DELETE for the old session, and only then create the new one. Server side, make DELETE actually stop the backend worker (kill its process group / session) and verify it with a process count 10 s later.
Verify with a headless Chrome CDP script: navigate to the slow item, wait ~25 s so requests are pending, dispatch a change event on the selector, and time until the status leaves busy. Here it went from hanging to 0.56 s. Alternatives: AbortController on every fetch, HTTP/2 (multiplexing removes the 6-connection limit), or a server-side cancel when the request socket closes.