Skip to content

fix(websocket): isolate routes per server without callback cycles - #229

Merged
justrach merged 2 commits into
mainfrom
codex/issue-227-websocket-route-isolation-final
Aug 26, 2026
Merged

justrach merged 2 commits into
mainfrom
codex/issue-227-websocket-route-isolation-final

Conversation

@justrach

Copy link
Copy Markdown
Owner

Closes #227.

Scopes native WebSocket route registries to each TurboServer/listener, carries registry identity through accepted connections and queued work, preserves app-local live replacement, and retains owned handler/guard snapshots for in-flight jobs.

Callback ownership is Python-GC-visible, so bound methods and closures that capture their app/server do not form hidden native cycles. Native registry entries borrow the state-owned callbacks; queued/in-flight work owns explicit snapshots. Interpreter checks happen before mutation and registration remains transactional.

Validation on current main:

No production deployment or release is included.

@github-actions

Copy link
Copy Markdown
Contributor

Performance Regression Report

Runner: ci-pr | Duration: 5s per endpoint | Threads: 4 | Connections: 100 | Workers: 24

Endpoint req/s avg latency p99 latency threshold status
GET /health 84,593 0.21ms 1.05ms 80,000 OK
GET / 86,354 0.23ms 1.00ms 80,000 OK
GET /json 82,695 0.27ms 0.94ms 75,000 OK
GET /users/123 82,603 0.27ms 0.84ms 75,000 OK
POST /items 47,923 0.48ms 1.20ms 45,000 OK
GET /status201 76,637 0.26ms 1.17ms 65,000 OK
AVERAGE 76,801 50,000 OK

✅ All endpoints pass regression thresholds

@justrach
justrach merged commit 6ac488b into main Aug 26, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebSocket routes leak across app instances through a global native registry

1 participant