Skip to content

fix: idle WebSocket connections are dropped after 30 seconds - #115

Merged
oleksandr-nc merged 2 commits into
mainfrom
fix/websocket-tunnel-timeout
Aug 14, 2026
Merged

fix: idle WebSocket connections are dropped after 30 seconds#115
oleksandr-nc merged 2 commits into
mainfrom
fix/websocket-tunnel-timeout

Conversation

@oleksandr-nc

Copy link
Copy Markdown
Contributor

While investigating #114 I found that idle WebSocket connections through HaRP are closed after exactly 30 seconds: the config defines no timeout tunnel, so after the 101 upgrade HAProxy falls back to timeout client for the tunnel, and any ExApp WebSocket that does not ping more often than that gets cut (termination flags cD-- in the access log).

This adds timeout tunnel, configurable through a new HP_TIMEOUT_TUNNEL variable that defaults to the value of HP_TIMEOUT_SERVER (1800s), so raising the server timeout keeps tunnels covered too. Setting it to 0 means unlimited: HAProxy has no infinite value for this timeout (a literal timeout tunnel 0 silently falls back to the client timeout again, verified live), so start.sh maps 0 to HAProxy's 24d maximum. Also adds timeout client-fin 30s so half-closed tunnels are reaped quickly instead of lingering for the whole tunnel timeout.

Tested live against a probe ExApp connected through a real FRP tunnel: on the current release an idle WebSocket dies at 30.0s; with this change it survives 120s of idle with the default, an explicit HP_TIMEOUT_TUNNEL=15s cuts it at 15s, and 0 keeps it alive. SSE streams (idle, headers-only, with pings), slow responses and the 30s request-phase client timeout all behave exactly as before.

…ed after 30s

Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com>
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@oleksandr-nc, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 550476c4-309a-48f4-8050-ef6fec73a44e

📥 Commits

Reviewing files that changed from the base of the PR and between 0326225 and 8a42b37.

📒 Files selected for processing (2)
  • README.md
  • start.sh
📝 Walkthrough

Walkthrough

Added HP_TIMEOUT_TUNNEL initialization, zero-value normalization, and export in start.sh. Configured HAProxy tunnel idle and client-fin timeouts. Updated timeout documentation for client inactivity, streaming responses, and upgraded connections.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: preventing idle WebSocket connections from being dropped after 30 seconds.
Description check ✅ Passed The description clearly explains the timeout issue, configuration changes, default behavior, and testing results.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f4d7d8f9-cdbd-4ac6-8325-3a716ba5e646

📥 Commits

Reviewing files that changed from the base of the PR and between ac0f3f4 and 0326225.

📒 Files selected for processing (3)
  • README.md
  • haproxy.cfg.template
  • start.sh

Comment thread README.md
Comment thread start.sh Outdated
… reaping

Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com>
@oleksandr-nc
oleksandr-nc merged commit 5c99345 into main Aug 14, 2026
17 checks passed
@oleksandr-nc
oleksandr-nc deleted the fix/websocket-tunnel-timeout branch August 14, 2026 10:12
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.

2 participants