-
Notifications
You must be signed in to change notification settings - Fork 39
Description
MCP Server Health Check False Positive on WSL2
Bug Description
dev3000 starts successfully, launches the browser, and the application works correctly, but after ~10 seconds it shuts down due to a false positive health check failure claiming "Port 3684 is no longer in use" even though the MCP server is still running.
Environment
- dev3000 version: 0.0.84
- Node.js: v20.19.1
- npm: 11.4.1
- OS: WSL2 (Windows Subsystem for Linux 2)
- Kernel: 6.6.87.2-microsoft-standard-WSL2
- Distribution: Ubuntu 22.04
- Project: Next.js 15.5.2 with Turbopack
Steps to Reproduce
-
Run dev3000 with
--debugflag on WSL2:dev3000 --port 4321 --debug
-
Wait for the application to start successfully:
- ✅ Next.js server starts on port 4321
- ✅ MCP server starts on port 3684
- ✅ Chromium browser launches
- ✅ Application renders correctly
- ✅ "Development environment ready!" message appears
-
Observe shutdown after ~10 seconds:
[DEBUG] Health check failed: Port 3684 is no longer in use ⚠️ Critical processes no longer detected. Shutting down gracefully...
Expected Behavior
dev3000 should continue running since:
- The MCP server process is still alive
- Port 3684 is still listening
- The Next.js application is functioning correctly
Actual Behavior
dev3000 shuts down with:
[DEBUG] Health check failed: Port 3684 is no longer in use
⚠️ Critical processes no longer detected. Shutting down gracefully...
🛑 Shutting down dev3000 due to critical failure...
Evidence
After shutdown, the MCP server is still running:
$ lsof -i :3684 2>/dev/null || fuser 3684/tcp 2>/dev/null
# Returns valid PIDs - server is still alive
$ curl http://localhost:3684
# Returns successful responseMCP server logs show successful startup:
[MCP-STDOUT] > dev3000-mcp-server@1.0.0 start
[MCP-STDOUT] > next start
[MCP-STDOUT] ▲ Next.js 15.5.1-canary.30
[MCP-STDOUT] - Local: http://localhost:3684
[MCP-STDOUT] ✓ Ready in 297ms
Additional Context
Timeline from Debug Logs
- 00:38:59 - MCP server starts successfully on port 3684
- 00:40:13 - Browser navigation complete, app renders
- 00:40:19 - Runtime console messages flowing normally
- 00:40:28 - Health check fails claiming port 3684 is down
- 00:40:28 - dev3000 initiates shutdown
The health check seems to be using an unreliable method for detecting port availability on WSL2.
Workaround Attempted
Using --debug flag successfully avoids the TUI "Raw mode is not supported" error on WSL2, but the health check issue persists.
Suggested Fix
The health check at line 423 of the debug log may need to:
- Use a more robust port detection method for WSL2 environments
- Add retry logic before declaring a critical failure
- Verify the actual process is dead, not just that the port check failed
- Use
lsoforfuseras fallback detection methods
Related Issues
This appears similar to issues with port detection in containerized or virtualized environments where network namespaces can cause false negatives in port availability checks.
Reproduction Rate
100% reproducible on WSL2 with the configuration above.