"myfile.mp4.upload.part" is locked after failed upload and server restart

Nextcloud version 18.0.3
Operating system and version Debian 10
PHP version 7.3.14

The issue you are facing:

I tried uploading some large files (2-4 GB) via the web interface and after it reached the “Processing files” state, it just didn’t do anything anymore.
I waited several minutes for it to finish, but at some point I just gave up and restarted the whole server (via ssh).
After the server was back, I tried re-uploading the files. The upload process started, seemed to be going well, but at the end I got an error saying “blabla.file.upload.part” is locked.
I found some other topics about this problem on the forums and the only useful piece of advice I could find was to just delete the parts manually.
I put the server in maintenance mode, deleted the .upload.part files manually and retried re-uploading. (after reboot and maintenance mode off).
Now I get “blabla.file” is locked (without .upload.part).

Is there some way I could solve this?
Could there be any corrupt database entries as well? If so, is there any way I can run a server “cleanup” or something?

Is this the first time you’ve seen this error? Y

Steps to replicate it:

  1. Upload one or more files via the web interface
  2. Wait for upload to reach “Processing files” state
  3. Wait a reasonable amount of time to pass
  4. Restart the server using ssh
  5. Try to upload the same files again
  6. Get an error saying the files are locked

The output of your Nextcloud log in Admin > Logging:

Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'SELECT * FROM `oc_jobs` WHERE (`reserved_at` <= ?) AND (`last_checked` <= ?) ORDER BY `last_checked` ASC LIMIT 1' with params [1590362260, 1590405460]: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

RedisException: read error on connection

Not sure if these two logs are related to the problem. They’re the only events that happened around the time I got the error.

Sorry. No real solution of your problem. Perhaps the program “occ” can help you.

Perhaps use this app to upload large files it it works again.


1 Like

Ok, I’ll give flowupload a try in the future.
In the meantime, can you please give some details about “occ”? What exactly should I do?

You can scan all files. Perhaps the program finds errors and then delete the files.

Test it:
sudo -u www-data php /path/to/your/nextcloud/occ files:scan --all


It is possible that there are other sub-commands.
Also it is perhaps possible to modify the MariaDB.

1 Like

I ran sudo -u www-data php /var/www/nextcloud/occ files:scan --all and it scanned all users, but no errors were found.

Do you know the name of the file? Can you find and delete it in data/user/files/… and then rescan?

1 Like

I’ve deleted the file and ran sudo -u www-data php /var/www/nextcloud/occ files:scan --path “/user/path_to_my_folder”.
No errors.

And now it works again? I think not. Sorry.

Ok, so I uploaded some of the files via the flowupload app (in the root folder) and then moved it to the locations where I initially uploaded them (and the corrupted parts should be as well) and they seem to be ok.
Also, I uploaded another file (that had caused problems earlier) via the normal upload and that seemed to work now, too.
So, I don’t know exactly what fixed the problem. Maybe the occ files:scan solved some problems silently.
Anyway, now it’s working.
Thank you very much for your help!