PUT file on /remote.php/dav/files/ to missing directory: random 503 instead 404


Nextcloud version (eg, 18.0.2):
Operating system and version (eg, Ubuntu 20.04): Ubuntu 18.04
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.29
PHP version (eg, 7.1): 7.2.24

The issue you are facing:
Randomly, when we put file in a missing directory, we receive 503 instead 404.

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

Steps to replicate it (randomly):

  1. run curl --location --request PUT ‘http://localhost/nextcloud/remote.php/dav/files/XXXX-XXX-XXX-XXX/storage/missing_path/test.pdf’ --header ‘Content-Type: application/x-www-form-urlencoded’ --form ‘File=@/tmp/test.pdf’ -v
  2. random 503
    (reproducible with pdf/zip files (unable to reproduce with txt file by example)
    In this example, we use a pdf of 80k with “test” content.

Excepted result (each time):

<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:message>File with name /storage/missing_path could not be located</s:message>

The output of your Nextcloud log in Admin > Logging:


Apache/php timeout set to 900s.

The output of your Apache log in /var/log/____:

[Thu Jul 16 19:18:36.760631 2020] [proxy_fcgi:error] [pid 21841] (32)Broken pipe: [client XXXXXX:XXXX] AH01075: Error dispatching request to : (sending stdin)

Someone have an idea on how to fix this issue?

I tried several conf but unable to fix it. CPU ok, load of 0.01, memory ok, disk ok, php fpm queue ok, no traffic during the tests.

Can be related more/less to https://github.com/owncloud/core/issues/18534 but this issue never been resolved