Repository navigation
Possible data loss after Document Server connection failure #381
Description
Steps to reproduce
Unfortunately I cannot provide reliable reproduction steps because the issue was only discovered after the fact.
The observed sequence was:
- Open a document in ONLYOFFICE through Nextcloud.
- Edit the document over a period of several weeks.
- Regularly close and reopen the document.
- Receive a notification email from Nextcloud stating that the ONLYOFFICE Document Server is unavailable.
- Discover that the document stored in Nextcloud is only at the state it had approximately four weeks earlier.
Expected behaviour
Document changes should be saved back to Nextcloud when the document is closed.
If saving fails, users should receive a clear error message and there should be no risk of silently losing weeks of edits.
Actual behaviour
The document was edited extensively over several weeks and appeared to work normally.
After receiving the "ONLYOFFICE Document Server is not available" notification, I discovered that:
- The document in Nextcloud only contains content from approximately four weeks ago.
- The Nextcloud version history also only contains versions up to that point.
- A Nextcloud backup taken before the notification email also contains only the old version.
This raises the concern that document changes may have existed only on the Document Server and were never written back to Nextcloud.
My main question is whether there is any possibility to recover such data from the Community Document Server (temporary files, caches, database entries, Docker volumes, etc.).
Server configuration
Web server: Unknown (managed Nextcloud by Hetzner), probably: Linux 6.8.0-106-generic x86_64
Database: mysql, 10.11.18
PHP version: 8.3.30
Nextcloud version: Current Hetzner-managed installation (can provide exact version if needed)
List of activated apps
Contacts
ONLYOFFICE
Activity
Brute-force-settings
Calendar
Client Push
Collaborative Tag
Comments
Community Document Server
Contacts Interaction
Dashboard
Deck
Deleted Files
Federation
File Reminders
File Sharing
Files download limit
First run wizard
Keeweb
Monitoring
Nextcloud Announcements
Nextcloud webhooks support
Notes
Notifications
PDF viewer
Password Policy
Photos
Polls
Pride Flags
Privacy
Quota warning
Recommendations
Related resources
Share by mail
Support
Talk
Tasks
Team Folders
Teams
Text
Two-factor-authentification…
Update notification
User status
Versions
Weather status
Nextcloud configuration
?
Browser
Browser name: Firefox (Flatpak)
Browser version: 151.0.3 (64-Bit)
Operating system: Linux, Zorin OS 18.1 Education
Browser log
No browser logs available because the issue was only noticed retrospectively.
The only notification received was:
"ONLYOFFICE Document Server is not available. This is an email message to notify you that the connection with the ONLYOFFICE Document Server has been lost. Please check the connection settings."
Activity
chadek commentedon Sep 15, 2026
Fixed for v0.4.0, by #396 — the cause, not the data, which I am afraid is gone: nothing survives of a document whose server-side change list was discarded, and there is no cache or temporary file to recover it from beyond what
occ documentserver:flushcould still write if that instance's documents are somehow still open.What you describe — weeks of editing, regular closing and reopening, and a file in Nextcloud stuck at an old version with no version history in between — is the ordinary behaviour of this app before v0.4.0 rather than a consequence of the document server becoming unavailable. It is the same root cause as #100.
What was wrong. The editor's "all changes are saved" meant the changes had reached this server's database, not that they had reached the file. Nothing wrote the file until the last participant had left and the
Cleanupbackground job had run. On an instance whose cron is slow, misconfigured, or set to AJAX, a document could be edited all day with nothing on disk — and a browser closed at the wrong moment lost the lot. Worse, the server never noticed an editor leaving at all: a document server that holds a WebSocket learns of it from the socket closing, but this one is polled over HTTP, so the pending poll was simply dropped and nothing ran to notice.What changed (#396, and #387 for the session accounting):
autosave_interval(60 s by default,0turns it off) since the last write — from the editing path itself, not from the background job. It costs one document assembly per interval per document being edited, however much is typed in between, and none at all while nobody is typing.closecommand, and a beacon sent by the page hosting the editor frame (it has to be the host page — a request started by a frame that is being detached is cancelled with it).To change the interval:
Proof. Two regression tests, driving real editors in headless chromium and reading the file on disk after each step — no cron, no
occ documentserver:flushanywhere in the run. Againstmasterjust now, Nextcloud 34, ONLYOFFICE connector 10.1, bundled Euro-Office 9.3.4:tests/rig/autosave_test.py— the file is written while the document is open:Step 1 is the whole issue: the text is in the Nextcloud file seconds after being typed, with the document still open. Step 2 is the cost control — a save inside the interval must not re-assemble the document. Step 4 is closing the editor: everything is in the file and the document is disposed of on the spot.
tests/rig/leave_test.py— two participants, and nobody runs anything:Step 2 is the other half of it — one person leaving must not end the document for everybody else — and step 5 reopens the file and asks the editor's own document model what it displays, rather than trusting the write.
The whole suite is green on
masteras of this comment:formats,smoke(every format opens, edits and reaches the file),flush-live,autosave,leave,twotab,coedit,coedit-xlsx,forcesave,chat. It runs in CI on pull requests and weekly, so this does not quietly regress again.If the instance still exists and any of those documents are somehow still open on it,
occ documentserver:flushon 0.4.0 would write them out — but after a "document server is not available" notification that is unlikely.