#3696 Wrangler fails to clear port binding on exit with error
Related to #4878. Port :8788 held after error exit. Affects next-on-pages workflow.
Fix cleanup logic to release port on error exit; consolidate with #4878
Analysis Report
Issue Review: cloudflare/workers-sdk#3696
Summary
Wrangler fails to release port binding on exit when an error occurs, requiring manual process kill.
Findings
- Created: 2023-08-02
- Updated: 2025-10-30
- Version: wrangler 3.4.0 → 4.61.0
- Component: wrangler, pages
- Labels: bug, pages
- Comments: 5
Key Evidence
- Affects
wrangler pages devwith next-on-pages in watch mode - When next-on-pages triggers rebuild, wrangler stops but holds port :8788
- Restarting wrangler fails: "Address already in use (127.0.0.1:8788)"
- Workaround:
lsof -i :8788to find PID, then kill it - Confirmed still reproducible (Apr 2024) with wrangler 3.52.0
- Related to #4878 (hang on exit after runtime failure)
- Nov 2024: User still reporting same issue
Recommendation
Status: KEEP OPEN
Reasoning: Valid bug affecting Pages local development, especially with next-on-pages. The port binding isn't properly released on error/exit. Almost 2.5 years old with continued reports. Related to #4878 (same root cause - improper cleanup on error).
Action: Fix the cleanup/shutdown logic in wrangler pages dev to properly release resources (port bindings) when exiting due to errors. Consider consolidating with #4878 as they share the same underlying issue.
Suggested Comment
This issue is related to #4878 - both involve improper cleanup when wrangler pages dev exits due to errors. The underlying issue is that the shutdown logic doesn't properly release resources.
Workaround:
lsof -i :8788 | grep LISTEN | awk '{print $2}' | xargs kill
Notes & Feedback (0)
No notes yet.