···11-# HTTP/1.1 Connection Pooling Limitation
22-33-## Problem Statement
44-55-When uploading a large file (8-9 seconds) and attempting to navigate to the homepage during the upload, the homepage hangs until the upload completes. The desired behavior is for uploads to continue in the background while allowing immediate navigation.
66-77-## What We Tried
88-99-1. **Toast notification system** - Successfully implemented global toast notifications using Svelte 5 runes
1010-2. **Fire-and-forget uploads** - Changed from `await` to `.then()` pattern
1111-3. **setTimeout wrapper** - Attempted to defer upload execution
1212-4. **Component lifecycle management** - Added `onDestroy` and `isMounted` tracking
1313-5. **AbortController** - Tried canceling uploads on navigation
1414-6. **Global upload manager** - Created `uploader.svelte.ts` similar to `player.svelte.ts`
1515-1616-## Why They All Failed
1717-1818-The root cause is **browser HTTP/1.1 connection pooling limits at the TCP level**:
1919-2020-- Chrome limits **6 concurrent HTTP/1.1 connections per hostname**
2121-- This is a browser-level TCP limitation, not a JavaScript execution issue
2222-- When a long-running upload occupies 1 connection, only 5 remain available
2323-- Homepage navigation triggers 2 fetch requests (`/auth/me` + `/tracks/`)
2424-- These requests get **queued** waiting for an available connection
2525-- No JavaScript pattern (async/await, promises, global state) can bypass TCP-level connection limits
2626-2727-## Proof
2828-2929-From our research:
3030-> "Chrome has a limit of 6 connections per host name, and a max of 10 connections total across all domains."
3131->
3232-> "When you initiate 100 HTTP/1.1 requests to a domain, only 6 requests will be processed concurrently at any given moment. The remaining requests will be queued."
3333-3434-Our network tab showed the `tracks/` request had status `(canceled)` after navigation, but the homepage still waited - confirming the requests were queued at the browser's connection pool level, not the JavaScript level.
3535-3636-## Actual Solutions
3737-3838-### 1. HTTP/2 (Recommended)
3939-4040-**Pros:**
4141-- Completely solves the problem via connection multiplexing
4242-- Allows unlimited concurrent requests over a single TCP connection
4343-- Production (Fly.io) likely already uses HTTP/2 over HTTPS
4444-- Industry standard solution
4545-4646-**Cons:**
4747-- Requires HTTPS (complicated for local development)
4848-- Need to configure uvicorn/Hypercorn for HTTP/2
4949-5050-**Implementation:**
5151-```python
5252-# Use Hypercorn instead of uvicorn
5353-# hypercorn supports HTTP/2 natively with h2 library
5454-```
5555-5656-### 2. Accept the Limitation
5757-5858-**Pros:**
5959-- No additional work required
6060-- Toast system still provides value for upload feedback
6161-- Production may not exhibit this issue if using HTTP/2
6262-6363-**Cons:**
6464-- Poor UX for large file uploads in local development
6565-- Users cannot navigate during uploads
6666-6767-### 3. Web Workers
6868-6969-**Pros:**
7070-- Uploads run in separate thread with separate connection pool
7171-- Truly non-blocking at JavaScript level
7272-7373-**Cons:**
7474-- Complex implementation
7575-- Still subject to browser connection limits
7676-- May not fully solve the problem
7777-7878-## Recommendation
7979-8080-1. **Keep the toast notification system** - it's valuable regardless
8181-2. **Keep the global upload manager** - clean architecture, ready for HTTP/2
8282-3. **Accept the local dev limitation** - it's likely not present in production
8383-4. **Consider HTTP/2 if issue persists in production**
8484-8585-## Files Modified
8686-8787-- `frontend/src/lib/toast.svelte.ts` - Global toast state (keep)
8888-- `frontend/src/lib/components/Toast.svelte` - Toast UI component (keep)
8989-- `frontend/src/lib/uploader.svelte.ts` - Global upload manager (keep)
9090-- `frontend/src/routes/+layout.svelte` - Toast integration (keep)
9191-- `frontend/src/routes/+page.svelte` - Loading state improvements (keep)
9292-- `frontend/src/routes/portal/+page.svelte` - Simplified to use global uploader (keep)
9393-9494-## Lesson Learned
9595-9696-Browser-level TCP connection pooling cannot be worked around with JavaScript patterns. The solution requires protocol-level changes (HTTP/2) or accepting the limitation.