Intermittent HTTP 500 in proxy.php on document close: /cool/ request reaches EOF before response headers

オープン
#364 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
38/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
php
領域
backend

調査の方向性

Start by reading richdocumentscode/proxy.php, especially the response-reading logic where fread() returns EOF before response headers arrive. Then identify which /cool/ operation runs during document close and compare its connection lifecycle with CODE-side events; the payload does not identify a specific operation or test. Done means establishing whether the close is expected and, if so, defining appropriate proxy handling, with a reproducible check for the HTTP 500.

索引モデルが issue の本文から書いたものです。

説明

Description

When using the built-in Collabora CODE server with Nextcloud 34, intermittent HTTP 500 responses occur in richdocumentscode/proxy.php, typically immediately after closing an Office document.

The editor remains functional: documents can be opened, edited, saved, and reopened successfully. The HTTP 500 errors have only been observed in server logs, without a corresponding visible browser error.

Temporary, error-triggered PHP instrumentation confirmed that the proxy encounters EOF while still waiting for HTTP response headers from the local CODE server.

The affected request belongs to the /cool/ endpoint category. The exact operation and the reason for the connection termination remain unknown.

Environment

Component Version / configuration
Operating system Debian 12
Virtualization Xen guest
Nextcloud 34.0.5.1
Nextcloud Office (richdocuments) 11.1.2
Built-in CODE (richdocumentscode) 26.4.502
PHP 8.2, PHP-FPM
Web server Apache, event MPM
Reverse proxy nginx
CODE connection Local TCP loopback, port 9983
CODE local SSL Disabled

The local CODE connection uses plain HTTP. This is intentional and does not establish an SSL configuration problem.

Steps to reproduce

  1. Open an existing DOCX or ODS document using Nextcloud Office with built-in CODE.
  2. Edit the document and save the changes.
  3. Close the document editor.
  4. Inspect the Apache access and error logs for requests to richdocumentscode/proxy.php.
  5. Repeat if necessary, as the issue is intermittent.

Actual behavior

Occasionally, a POST request to richdocumentscode/proxy.php returns HTTP 500 immediately after the document is closed.

The Apache error log reports:

No content in reply from coolwsd. Is SSL enabled in error ?

The error originates from the PHP proxy's response-reading logic when fread() returns an empty string while response headers are still expected.

Instrumentation results

Two separate reproductions were captured using temporary, error-triggered instrumentation.

First reproduction:

rest_bytes=0
eof=1
timed_out=0
unread_bytes=0

A single HTTP 500 POST to richdocumentscode/proxy.php was recorded during the same reproduction window.

Second reproduction:

endpoint=cool
rest_bytes=0
eof=1
timed_out=0
unread_bytes=0

The endpoint classification was derived from the normalized request path without logging document identifiers, tokens, or complete URLs.

An independently correlated HTTP 500 access-log entry was not established for the second reproduction.

Interpretation

The observations indicate that:

  • The PHP proxy encounters EOF before receiving any HTTP response-header bytes.
  • PHP does not report a stream timeout.
  • No unread buffered bytes were reported.
  • At least one affected request belongs to the /cool/ endpoint category.
  • The exact /cool/ operation remains unidentified.
  • The initiator and reason for the connection termination have not been established.

These observations do not prove that CODE crashed, that SSL is misconfigured, or that the connection termination itself was abnormal.

Expected behavior

Closing a document should not produce an unexplained HTTP 500 response.

If a connection is intentionally terminated during a normal document-close operation, the proxy should handle that condition appropriately rather than reporting an unexpected upstream failure.

Additional observations (causal relationship not established)

During the investigation, several other potentially relevant symptoms were observed:

  • HTTP 404: Repeated GET requests returned HTTP 404. During one approximately two-minute reproduction window, ten such responses were recorded. The affected endpoints have not yet been classified.
  • EPIPE / Broken pipe: Broken-pipe errors have also been reported during the broader investigation. Their exact source, frequency, and temporal relationship to the HTTP 500 events have not yet been verified.
  • Normal document functionality: Editing, saving, and reopening documents continued to work.
  • Increasing the PHP-FPM worker limit did not eliminate the observed problem.

It is currently unknown whether these observations share a common cause or represent independent issues.

Diagnostic limitations

A separate system-call trace was performed with socket and I/O events, without capturing application payloads.

The trace did not establish a definitive request-to-socket correlation or identify the specific CODE operation responsible for the HTTP 500.

Therefore, the evidence is insufficient to determine whether the EOF results from an expected document-close sequence, a CODE-side error, or another connection-lifecycle condition.

Temporary instrumentation and rollback

The diagnostic instrumentation was applied only temporarily to the PHP proxy and has been completely removed.

The restored production file was verified to be byte-identical to the saved original. PHP syntax validation succeeded, and PHP-FPM remained active after rollback.

Questions for maintainers

  1. Are there known /cool/ operations during document closure that may intentionally close the upstream connection without sending an HTTP response?
  2. Could this behavior be related to the connection lifecycle of the built-in CODE proxy?
  3. Should proxy.php distinguish between an expected connection closure and an unexpected upstream EOF?
  4. Is there a recommended privacy-preserving way to identify the specific /cool/ operation and correlate the PHP request with CODE-side events?
  5. Is this a known issue in richdocumentscode 26.4.502?

Related issue

  • CollaboraOnline/richdocumentscode#358 concerns a different observed proxy response-handling problem. No shared root cause is established.

Impact

Low observed operational impact.

The issue generates intermittent HTTP 500 entries in server logs, but document editing and saving remain functional. No confirmed data loss or user-visible failure has been observed.

主要言語
PHP
スター
156
フォーク
37
平均マージ
23時間 51分
マージ済み PR(30日)
2

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

CollaboraOnline/richdocumentscode のほかの issue

CollaboraOnline/richdocumentscode の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。