Description
Describe the bug
The collaboration service fetches the WOPI discovery of its office app (/hosting/discovery) at startup and then every COLLABORATION_CS3API_APP_REGISTRATION_INTERVAL (30 s by default), and registers itself as app provider with the mimetypes it found (services/collaboration/pkg/command/server.go).
When a fetch fails, the app URLs are cleared on purpose ("empty map to clear previous URLs"), and the service registers with an empty list of mimetypes. It tries again only at the next tick. So a single failed fetch, e.g. while the office app restarts, makes opening documents with that app fail for up to 30 s:
POST /app/open?app_name=OnlyOffice&file_id=...
500 Internal Server Error
{"code": "SERVER_ERROR", "message": "Error contacting the requested application, please use a different one or try again later"}
This happens at startup, when the office app isn't ready yet, but also later: a fetch that fails once clears URLs that worked a moment before.
Meanwhile, the service reports itself healthy and ready: /healthz and /readyz only check that its own HTTP and gRPC ports answer (services/collaboration/pkg/server/debug/server.go), not whether it has the app URLs. Orchestrators and health checks (Kubernetes readiness probes, the CI) can't tell that it can't open anything yet.
Steps to reproduce
- Start OpenCloud and a collaboration service for an office app, while the office app's discovery endpoint doesn't answer yet (or returns 502).
- Make the discovery endpoint answer.
- Within the registration interval, open a document with that app (
POST /app/open?app_name=...).
Expected behavior
- After a failed fetch, the service retries soon (with a backoff), not only after the full registration interval.
- A transient failure doesn't throw away app URLs that worked before; they are replaced by the next successful fetch.
/readyzreports "not ready" until the app URLs have been fetched once.
Actual behavior
app-open fails with 500 for up to 30 s after one failed fetch, while /readyz reports ready.
Additional context
Found while looking into unstable OnlyOffice scenarios of apiCollaboration/checkFileInfo.feature in the CI: #3994. The CI side is fixed separately (see #3994). #3901 is about the same fetch (a connection leak in GetAppURLs).
AI assistance: Claude Code (claude-opus-5-5) analysed the CI logs and the code, and wrote the first draft of this issue.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsPrio <= 3
Activity