Reading of file continues after download operation ends

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 18.0.2): 19.0.2
Operating system and version (eg, Ubuntu 20.04): Host: Raspbian Buster, OS inside container: Debian Buster
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.38
PHP version (eg, 7.1): 7.4.9

I’m using the Apache version of the official Nextcloud docker image:

The issue you are facing:
If I start to download a bigger file (in the example 1,2 GB), then either after the download completes successfully, or after I cancelled the download before completion, Nextcloud’s Apache webserver will keep reading the file for some time (at most 2 minutes, but at least a half. haven’t done precise measurements).

Is this the first time you’ve seen this error? (Y/N): It occurs across container restarts and host OS reboots, so I think the answer is yes, except that it’s not really an error (NC does not log errors when this happens neither on the command line output, nor in the nextcloud.log file, nor on the admin interface)

It may be an important detail that the file is on a local external storage, which is an NTFS partition mounted on /media/ with the following options: user,defaults,big_writes,nofail,noexec .
I tried to reproduce it with a big file stored on the main storage, but copying of the file to there always errored out

Steps to replicate it:

  1. Find a big file (>= 1 GB) on your Nextcloud instance (preferably one originating from a local external storage)
  2. Open an SSH session or a terminal on the server, and run either htop or iotop to watch io performance
  3. Start download through “3 dots menu”\Download
  4. Either wait until the download finishes, or cancel the download

At the end, you should see that tens of MBs will continue to be read from the disk by the same 2 processes (Apache and mount.ntfs)

I tried what would happen if I read the big file in the simplest way (cat “filepath” > /dev/null).
It was reading with the same speed as NC, but both when cat exited by itself and when I stopped it manually, the read operations stopped immediately according to iotop and htop

The output of your Nextcloud log in Admin > Logging:

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

The output of your Apache/nginx/system log in /var/log/____:
in reply

Sorry for breaking the last link a bit, but otherwise the forum said that I can’t post more than 4 links

The forum said that I can’t post more than 4 links (?) in the same post, so here are the other 2:


Apache server log: