Skip to content

Interrupted file download doesn't stop Nextcloud reading and sending files. #15055

@vfreex

Description

@vfreex

If a user downloads a large file (let's say, > 10GB) then immediately interrupts the download, Nextcloud will continue to read and send the served file, which causes unnecessary I/O. If the user repeats the action, the server will be overwhelmed and download speed is low due to busy I/O. (Unfortunately, this is common when using Nextcloud dav as the media streaming backend)

After investigation, I found this issue is caused by ignore_user_abort(true) function calls in those files:

apps/dav/appinfo/v2/direct.php
apps/dav/appinfo/v2/remote.php
apps/dav/appinfo/v1/webdav.php
lib/private/legacy/files.php
lib/private/Files/View.php

After changing to ignore_user_abort(false), this problem will not persist.

But, my assumption is that Nextcloud uses ignore_user_abort(true) to do some cleanups, so naively changing it to false could cause some resource leaks.

Is there any graceful way to solve this?

Steps to reproduce

  1. Download a large file with dav, then immediately interrupt the download.
  2. Check I/O operation on the server

Expected behaviour

Tell us what should happen
The server should stop reading the served file from storage.

Actual behaviour

Tell us what happens instead
The server continue to read the served file from storage.

Server configuration

Operating system:
CentOS 7.6 in container
Web server:
apache
Database:
postgresql 9.6
PHP version:
7.2
Nextcloud version: (see Nextcloud admin page)
15
Updated from an older Nextcloud/ownCloud or fresh install:
fresh
Where did you install Nextcloud from:
nextcloud/docker
Signing status:

Signing status
Login as admin user into your Nextcloud and access 
http://example.com/index.php/settings/integrity/failed 
paste the results here.

List of activated apps:

App list
If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your Nextcloud installation folder

Nextcloud configuration:

Config report
If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your Nextcloud installation folder

or 

Insert your config.php content here. 
Make sure to remove all sensitive content such as passwords. (e.g. database password, passwordsalt, secret, smtp password, …)

Are you using external storage, if yes which one: local/smb/sftp/...

Are you using encryption: yes/no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...

LDAP configuration (delete this part if not used)

LDAP config
With access to your command line run e.g.:
sudo -u www-data php occ ldap:show-config
from within your Nextcloud installation folder

Without access to your command line download the data/owncloud.db to your local
computer or access your SQL server remotely and run the select query:
SELECT * FROM `oc_appconfig` WHERE `appid` = 'user_ldap';


Eventually replace sensitive data as the name/IP-address of your LDAP server or groups.

Client configuration

Browser:

Operating system:

Logs

Web server error log

Web server error log
Insert your webserver log here

Nextcloud log (data/nextcloud.log)

Nextcloud log
Insert your Nextcloud log here

Browser log

Browser log
Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log
c) ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmapbug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions