Files disappear (deleted) during synchronization при синхронизации пропадают (удаляются) файлы

Hello!
I am a Russian speaker and use a translator to translate into English. (texts are duplicated in two languages)

files disappear (deleted) during synchronization

system:
SRV: dietpi, nextcloud, docker (collaboraoffice)
ARM: Win10, nextcloud client

custom logic:
on ARM there are a lot of editable files .xlsx .docx, etc., they are automatically uploaded to SRV. if necessary, the file is edited via the Web (this happens very rarely) and changes are recorded from SRV to ARM.
There is access from the client for smartphones and Android tablets. (mostly reading)
files are created in large numbers and some are edited regularly on ARM so the process is very dynamic!

what’s happening:
at some point after the file is created on ARM, it disappears on both ARM and SRV. (the events are not related to the access of the Web editor or smartphone) files disappear randomly, one from the folder, all from the folder, regardless of the period (noted at a depth of events of 6 months)
It was very difficult to catch missing data.

I suspect the problem is the following:

  1. nextcloud client sends files to SRV in the specified folder; the process of indexing the recorded files does not occur on SRV and they do not appear in the Web interface.
  2. nextcloud client checks for file updates on SRV directly in the Web directory, since the indexing process did not take place, then this file is not in the Web directory and nextcloud client writes an empty space to ARM instead of the file.

Are my assumptions about the problem correct?
how to treat it?

Привет!
я рускоговорящий и для перевода на английский использую переводчик. (тексты дублирую на двух языках)

при синхронизации пропадают (удаляются) файлы

система:
SRV: dietpi, nextcloud, docker (collaboraoffice)
ARM : Win10, nextcloud client

настраиваемая логика:
на ARM много редактуруемых файлов .xlsx .docx и т.д., они автоматом льются на SRV. при необходимости файл редактируется челез Web (бывает очень редко) и происходит запись изменений с SRV на ARM.
есть длоступ с клиента для смарфона и планшета андройд. (в основном чтение)
файлы создаются в большом количестве и некоторые регулярно редактируются на ARM так что процесс очень динамичен!

что происходит:
в какой-то момтент времени после создания файла на ARM он пропадает и на ARM и на SRV. (события не связаны с обращением Web редактора или смартфона) файлы пропадают рандомно, один из папаки, все из папки, независимо от срока (заметил на глубине событий 6 месяцев)
было очень сложно отловить пропажи данных.

подозреваю что проблема в следующем:

  1. nextcloud client отправляет файлы на SRV в указанную папку, на SRV не происходит процесс индексации записанных файлов и они не появляются в Web интерфейсе.
  2. nextcloud client проверяет наличие обновлений файлов на SRV непосредственно в Web директории, поскольку процесс индексации не состоялся, то в Web директории нет этого файла и nextcloud client записывает на ARM пустое место вместо файла.

правильны ли мои предположения о проблеме?
как это лечить?

1 Like

You can try to follow up the history by reading through the logs, if a client deletes a file, there should be the DELETE statement in the webserver access log.
If you think, the server does not register everything, you should see problems with the database, e.g. timeouts etc. in the logfiles a lot (mainly Nextcloud and webserver logs).

Are the files in the trashbin? Then the files was “officially” deleted, meaning through the webdav interface by either a client or the web interface.

Is the file still in the file system (the data folder)?

I read the logs in the web interface - there are no DELETED events
(perhaps it’s worth reading some more, which ones and where they are?)

I didn’t see any problems with the database in the logs accessible via the web interface
there are errors, but they are of a different kind

missing files don’t go to trash
missing files - completely deleted both in the folder on ARM and in the folder on SRV

логи читал в вебинтрефейсе - событий DELETED нет
(возможно стоит почитать еще какие-то, какие и где лежат?)

проблем с базой данные в логах доступных через вебинтерфейс я не увидел
ошибки есть, но они другого рода

пропавшие файлы не попадают в корзину
пропавшие файлы - удалены полностью и в папаке на ARM и в папке на SRV

E.g. if I delete a file in the webinterface, I have this line in the access logs:

ip - - [09/Jan/2024:09:42:30 +0100] nextcloud.example.net "DELETE /remote.php/dav/files/username/temp/test_file.md HTTP/2.0" 204 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0" "-"

Then you would know which client deleted the file and when it was deleted.

I found another group of missing files, this time they were missing only on ARM
(but synchronization is now stopped, and also the following was executed on the server: sudo -u www-data php /var/www/nextcloud/occ files:scan --all so perhaps the example is not accurate)
the print screen displays sequentially Web, CLI SRV, the original folder with the file on ARM (where it disappeared)
нашел еще группу пропавших файлов, на этот раз пропали они только на ARM
(но синхронизация сейчас остановлена, а также на сервере было выполнено следующее sudo -u www-data php /var/www/nextcloud/occ files:scan --all так что возможно пример не точный)
на принтскрине отображены последовательно Web, CLI SRV, исходная папка с файлом на ARM (где он пропал)

below is a log search screen
as you can see in the logs, the name of this file is mentioned only once when it is created
далее скрин поиска по логам
как видно в логах название этого файла упоминается только один раз при его создании

found another example

On SRV the folder “October” is missing entirely
on ARM there is a folder “October”, but there are no files in it, and its status is also unclear

There are only two events in the logs for this file, 1 - renaming (I create it by copying the previous one and renaming) 2 - editing.

that is, he was on SRV but there are no traces of him left (((

нашел еще пример

на SRV папка “октябрь” отсутствует целиком
на ARM папка “октябрь” есть, но файлов в ней нет, а также непонятен ей статус

в логах по этому файлу всего два события, 1 - переимеование (создаю способом копирования предыдущего и переименовывания) 2 - редактироавние.

то есть он был на SRV но его следов не осталось(((


In the first case, on the terminal the filenames have quotation marks, not sure if that is a problem for the windows client.
However, I managed to create a file 'test.txt' on Windows and it was synced to my Nextcloud.

In the first case, I’d create a file in this specific folder on the client and see what it does. You can perhaps try a file with quotation marks and without, if it makes a difference. For folder changes, it should trigger to recheck the folder. In case of problems, it is good to check the server and the client logs, perhaps it reveals more details.

I checked a number of other folders on the server and on the client. Single ‘quotes’ on the server are placed arbitrarily on file and package names. I don’t know why this is connected, but files with and without quotes can be easily read regardless of the quotes.

During the verification process, I found another place of discrepancy, on the client the files are there and marked as synchronized with the server, but on the server they are missing in both the CLI and the Web (screenshot)

я проверил ряд других папок на сервере и на клиенте. одинарные ’ кавычки ’ на сервере стоят произвольно на именах файлов и пакок. с чем это связано не знаю, но файлы с кавычками и без спокойно читаются независимо от кавычек.

в процессе проверки нашел еще одно место несоответсвия, на клиенте файлы есть и отмечены как синхронизированные с сервером, но на сервере они отсутствуют и в CLI и в Web (скрин)

Do other processes access the data folder, or are you uploading manually stuff to the data folder (e.g. with SMB, FTP, SCP, …)? Changes should go through Nextcloud by using webinterface, the clients or connect directly through webdav, then the database takes into account all the changes.

The folder you are showing just belong to one user? These are not shared with other users? If they do changes, it takes some time to propagate the changes to all the other clients. However, DELETE commands should then be found in your webserver access logs.

customizable operating logic
on the client (ARM) a file is generated (or the file was generated before)
file via nextcloud client gets to the server (SRV)
if file changes occur on the server (SRV), then these changes must be overwritten and on the client (ARM) nextcloud client is responsible for this

I do not use third-party (SMB, FTP, SCP, …) services for uploading data directly to the server.

the folders belong to only one physical user, me, and there are no changes other than mine in the folders and files.

I don’t find DELETE commands for missing files in the logs

настраиваемая логика работы
на клиенте (ARM) генерируется файл (или файл был сгененирован до)
файл по средсвам nextcloud клиет попадает на сервер (SRV)
если на сервере(SRV) произошли изменения файла, то эти изменения должны быть перезаписаны и на клиенте(ARM) за это отвечает nextcloud клиет

сторонних (SMB, FTP, SCP, …) сервисов загрузки данных напряму на сервер я не использую.

папки принадлежат только одному физическому пользователю, мне, и изменений кроме моих в папках и файлах нет.

я не нахожу в логах команд DELETE для пропавших файлов

It’s sad that there is still no answer to my question (((

Печально, что ответа на мой вопрос так и нет(((

This can be one reason, files appear or disappear and Nextcloud reacting strangely to it.

Not sure, the other idea was a problem with the non-ASCII characters. To be sure, you could try ASCII characters only (in the whole path and filename), if you are able to reproduce.

Not sure if the device is sometimes at its limits, and then you run into timeouts (e.g. then the database might not be updated correctly). But such things should show up in some log files. Or log the database slow queries.
Did you install redis for file-locking?

Good, then it is no client doing strange things. There is some software that copies a file on opening and when you close it, it deletes the old one and renames the copied version (or something strange like that). In such cases you loose different versions, or if the client does not follow the procedure, it might lead to some issues. But that seems not to be the case for you.

Are these only office files, or can you reproduce this with normal text files as well?

Sorry, I’m just guessing.