mirror of
https://github.com/jwadow/kiro-gateway.git
synced 2026-04-25 01:15:57 +03:00
Labels
No labels
bug
bug
enhancement
enhancement
fixed
fixed
invalid
needs-info
needs-testing
pull-request
question
upstream
wontfix
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/kiro-gateway-jwadow#35
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @bhaskoro-muthohar on GitHub (Jan 23, 2026).
Original GitHub issue: https://github.com/jwadow/kiro-gateway/issues/54
Kiro Gateway Version
latest (includes fix from #38)
What happened?
Gateway accumulated 100 CLOSE_WAIT connections after VPN disconnect. The fix from #38 (
Connection: closeheader) works correctly under stable network conditions, but fails when the network interface changes (e.g., VPN connect/disconnect).Root Cause
When VPN disconnects, connections made through the VPN interface become orphaned:
Evidence
Verification
After restarting the gateway (without VPN), the fix works correctly:
Reproduction
lsof -p <pid> | grep -c "CLOSE_WAIT"Proposed Fix
Option 1: Don't use shared client for streaming requests
Option 2: Document workaround - restart gateway after VPN changes
Debug Logs
N/A - gradual resource leak, not immediate error.
Related
Regression of #38 - original fix works under stable network, fails on interface change
@jwadow commented on GitHub (Jan 23, 2026):
Checked your logs. Found the root cause - it's not a regression of #38, it's a fundamental issue with connection pooling when network interfaces change.
Here's what happens: VPN disconnects -> sockets from old interface (172.16.0.2) get stuck in CLOSE_WAIT -> can't be closed because no route -> accumulate forever in the pool.
The
Connection: closeheader from #38 tells the server not to reuse connections, but doesn't help with already-established connections that become orphaned.Fixed it by using per-request clients for streaming. Makes sense because streaming requests are long-lived and don't benefit from pooling anyway. Non-streaming still uses shared pool.
Can you test? Should see CLOSE_WAIT stay at 0-1 after VPN changes instead of climbing to 100+
@bhaskoro-muthohar commented on GitHub (Jan 24, 2026):
Tested and confirmed fix works! 🎉
Test results:
Previously this would climb to 100+ after VPN disconnect. Per-request client for streaming fixes it completely.
Thanks for the quick fix!