HP_TIMEOUT_CLIENT=30s too short for persistent MCP SSE streams — causes session termination
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 68/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- docker, python
- 領域
- devops, infrastructure
調査の方向性
まず、HaRP が AIO デプロイメント用の HP_TIMEOUT_CLIENT を定義または渡している箇所を特定し、HP_TIMEOUT_SERVER およびここで説明されている永続的な MCP SSE の動作と比較します。長時間アイドル状態を維持する GET ストリームで変更を検証し、30 秒を超えてもセッションが使用可能なままであることを確認します。デフォルト値を安全に変更できない場合は、設定を文書化するか公開してください。
索引モデルが issue の本文から書いたものです。
説明
Summary
The HaRP proxy deployed by Nextcloud AIO ships with HP_TIMEOUT_CLIENT=30s. This timeout is too short for persistent MCP sessions (MCP Streamable HTTP, protocol version 2025-03-26), causing any stateful MCP client session to be terminated after ~30 seconds of the GET stream being idle.
Steps to Reproduce
- Install context_agent on Nextcloud AIO with HaRP enabled
- Connect a MCP client using Streamable HTTP with persistent sessions (
stateless_http=False) - Client opens a persistent GET SSE stream (server→client push channel) after
initialize - After ~30 seconds of no activity on the GET stream, HaRP closes the connection
- The server's
StreamableHTTPServerTransportdetects the closed stream and callsterminate() - Client receives
McpError: Session terminatedon the next keepalive ping or request - Client reconnects — loop repeats indefinitely
Root Cause
HaRP's HP_TIMEOUT_CLIENT=30s applies to the entire client-side HTTP connection, including long-lived SSE streams. The MCP Streamable HTTP protocol requires a persistent GET SSE stream for server→client push messages. This stream is intentionally idle (no data flows unless the server pushes) — but HaRP's client timeout doesn't distinguish between a truly idle connection and a healthy long-lived SSE stream.
HP_TIMEOUT_CLIENT=30s # closes any client connection after 30s idle
HP_TIMEOUT_SERVER=1800s # server-side correctly set to 30 minutes
The asymmetry between client (30s) and server (1800s) timeouts is the issue.
Observed in Logs
Container logs (nc_app_context_agent):
Created new transport with session ID: 9d7d0dc8...
Terminating session: 9d7d0dc8... ← after exactly ~12s (HaRP closes the GET stream)
Hermes Agent logs:
MCP server 'Nextcloud' keepalive failed, triggering reconnect (state: connected → degraded): McpError: Session terminated
Expected Behavior
HP_TIMEOUT_CLIENT should be set to a value that accommodates long-lived SSE streams, e.g. 600s or higher. Alternatively, AIO documentation should note that MCP clients require an increased HP_TIMEOUT_CLIENT.
Suggested Fix
Increase the default HP_TIMEOUT_CLIENT for AIO HaRP deployments:
HP_TIMEOUT_CLIENT=600s # 10 minutes — accommodates MCP SSE streams
Or expose HP_TIMEOUT_CLIENT as a configurable AIO environment variable so administrators can set it without recreating the HaRP container manually.
Workaround
Recreate the nextcloud-aio-harp container manually with HP_TIMEOUT_CLIENT=600s. This override is lost on every AIO update.
Environment
- Nextcloud AIO: latest (Nextcloud 33.0.7)
- HaRP:
ghcr.io/nextcloud/nextcloud-appapi-harp:release - Default
HP_TIMEOUT_CLIENT=30s - MCP client: any client using Streamable HTTP persistent sessions (Hermes Agent, Claude Code, etc.)
Relation
This issue is a companion to nextcloud/context_agent#227 — even when that issue is fixed (stateless_http=False), persistent MCP sessions will still fail unless this timeout is also addressed.
- 主要言語
- Python
- スター
- 56
- フォーク
- 10
- 平均マージ
- 13時間 38分
- マージ済み PR(30日)
- 29
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nextcloud/HaRP のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
nextcloud/HaRP#151 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
メンテナーはふだん 1 日以内に返信
-
bug ExApp issue
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
nextcloud/HaRP#61 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 32/100
nextcloud/HaRP#50 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
nextcloud/HaRP#49 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
follow-up
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
modelscope/modelscope#1833 ·
メンテナーはふだん 1 日以内に返信
-
ocr_data_to_elements() raises AttributeError when a layout element is a List対応中かも @Eapp1e が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
Unstructured-IO/unstructured#4616 ·
メンテナーはふだん 1 日以内に返信