Sporadic 404's for applications that use temporary files

Hi all,

I have something weird with a WebDav that I’m using with nextcloud.

Nextcloud version (eg, 12.0.2): 13.0.4
Server: (eg, Ubuntu 17.04): Linux nextcloud_srv 4.15.0-24-generic #26-Ubuntu SMP Wed Jun 13 08:44:47 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Client: Windows 10

Apache or nginx version (eg, Apache 2.4.25):
Server version: Apache/2.4.29 (Ubuntu)
Server built: 2018-06-07T21:10:10

PHP version (eg, 7.1):
PHP 7.2.10-0ubuntu0.18.04.1 (cli)

The issue you are facing:

I have a webdav mapping to a grouped folder I use between me and my daughter (she downloads her report cards (PDF) from school to this folder or any other documents I need to read or sign).

Sometimes, it seems like the temporary files overwrite the final file.
For example:
Chrome first creates a report_card.pdf.crdownload file.
When the download is complete, the crdownload file is removed and is turned into a .pdf

We had multiple occasions, allthough sporadic, of the document not merging into the final .pdf, but remaining as the temporary .crdownload file.

After renaming the file from .pdf.crdownload to .pdf, we can open it again, and it does seem complete.

Are there any known limitations to what we’re doing that are causing this?
We also had this with a Word temporary file that got saved as [Hex String].tmp

After renaming to .docx, we managed to open the document without errors or corruption.

Is this the first time you’ve seen this error? (Y/N): No

Steps to replicate it:

  1. Download file from chrome directly into shared webdav folder
  2. Navigate to the file
  3. a 404 is returned.
  4. Sadly this is not always the case and this isn’t a conclusive reproducible scenario, but it has frequently happened when doing this.

The output of your Nextcloud log in Admin > Logging:
Log snippet of the time where she saved the file, she saved it on 2018-09-19 at 00:15, so no errors seem to be in the log of this particular event.

|Error|no app in context|OC\User\LoginException: User disabled|2018-09-19T01:28:54+0200|
|---|---|---|---|
|Fatal|webdav|Sabre\DAV\Exception\RequestedRangeNotSatisfiable: The start offset (116260864) exceeded the size of the entity (11626565)|2018-09-18T16:46:42+0200|

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'ocyx6xff49ct',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    0 => 'IP.OF.OUR.HOME.SERVER',
    1 => 'DOMAIN.OF.OUR.SERVER',
  ),
  'datadirectory' => '/var/nextcloud-data',
  'overwrite.cli.url' => 'http://IP.OF.SERVER/nextcloud',
  'dbtype' => 'mysql',
  'version' => '13.0.4.0',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextcloud',
  'dbpassword' => '',
  'installed' => true,
);

The output of your Apache/nginx/system log in /var/log/____:
Error log for apache shows nothing around the time of the upload (00.15)

[Tue Sep 18 13:44:05.068057 2018] [php7:error] [pid 10741] [client 51.255.143.163:47742] script '/var/www/html/wp-login.php' not found or unable to stat
[Tue Sep 18 19:18:16.999229 2018] [php7:error] [pid 15046] [client 5.188.210.12:62026] script '/var/www/html/echo.php' not found or unable to stat, referer: https://www.google.com/
[Wed Sep 19 06:25:05.122980 2018] [mpm_prefork:notice] [pid 5595] AH00171: Graceful restart requested, doing restart

It’s kind of ironic that we have customers running 20+ WebDav clients, reading and writing simultaneously with no issues at all, but at home, this unexplicable stuff happens :slight_smile:

Edit:
Small addition, in my daughter’s activity logs (the user that downloaded the file to nextcloud), There’s only note of the creation of the .crdownload file, allthough chrome clearly said it had completed the download.

Je creëerde [report_card.pdf.crdownload](https://OUR.DOMAIN/nextcloud/index.php/f/435162)