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

未关闭
#364 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
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 分钟
30 天内合并 PR
2

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

CollaboraOnline/richdocumentscode 的其他 Issue

查看 CollaboraOnline/richdocumentscode 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。