Filesize(): stat failed for PATH at /var/www/nextcloud/lib/private/LargeFileHelper.php#173

Steps to reproduce

  1. Upload files

Expected behaviour

Uploade the files smoothly

Actual behaviour

Spaming the log and kill the upload + uploaded files

Server configuration detail

Operating system: Linux 5.4.51-v7l+ #1333 SMP Mon Aug 10 16:51:40 BST 2020 armv7l

Webserver: nginx/1.14.2 (fpm-fcgi)

Database: mysql 10.3.23

PHP version:

7.3.19-1~deb10u1
Modules loaded: Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, session, sodium, standard, cgi-fcgi, mysqlnd, PDO, xml, apcu, bcmath, bz2, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, gmp, iconv, igbinary, imagick, intl, json, ldap, exif, mysqli, pdo_mysql, pdo_pgsql, pgsql, apc, posix, readline, redis, shmop, SimpleXML, smbclient, soap, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xmlreader, xmlrpc, xmlwriter, xsl, zip, Phar, libsmbclient, Zend OPcache

Nextcloud version: 19.0.3 - 19.0.3.1

Updated from an older Nextcloud/ownCloud or fresh install: fresh install

List of activated apps
Enabled:
 - accessibility: 1.5.0
 - activity: 2.12.0
 - admin_audit: 1.9.0
 - announcementcenter: 3.8.1
 - browser_warning: 1.0.0
 - bruteforcesettings: 2.0.1
 - calendar: 2.0.4
 - checksum: 0.4.5
 - circles: 0.19.5
 - cloud_federation_api: 1.2.0
 - comments: 1.9.0
 - contacts: 3.3.0
 - contactsinteraction: 1.0.0
 - dashboard: 6.0.0
 - dav: 1.15.0
 - deck: 1.0.5
 - drawio: 0.9.7
 - drop_account: 0.2.1
 - duplicatefinder: 0.0.2
 - encryption: 2.7.0
 - end_to_end_encryption: 1.5.2
 - external: 3.6.0
 - extract: 1.2.4
 - federatedfilesharing: 1.9.0
 - federation: 1.9.0
 - files: 1.14.0
 - files_3d: 0.3.1
 - files_accesscontrol: 1.9.1
 - files_antivirus: 3.0.0
 - files_automatedtagging: 1.9.0
 - files_external: 1.10.0
 - files_lock: 0.8.3
 - files_pdfviewer: 1.8.0
 - files_retention: 1.8.2
 - files_rightclick: 0.16.0
 - files_sharing: 1.11.0
 - files_trashbin: 1.9.0
 - files_versions: 1.12.0
 - files_videoplayer: 1.8.0
 - firstrunwizard: 2.8.0
 - forms: 2.0.4
 - group_everyone: 0.1.5
 - groupfolders: 7.0.0
 - imageconverter: 1.2.1
 - impersonate: 1.6.1
 - issuetemplate: 0.7.0
 - login_notes: 0.3.0
 - logreader: 2.4.0
 - lookup_server_connector: 1.7.0
 - mail: 1.4.1
 - maps: 0.1.6
 - news: 14.2.2
 - nextcloud_announcements: 1.8.0
 - notes: 3.6.4
 - notifications: 2.7.0
 - oauth2: 1.7.0
 - ocdownloader: 1.7.8
 - ocsms: 2.1.8
 - password_policy: 1.9.1
 - passwords: 2020.9.0
 - phonetrack: 0.6.4
 - photos: 1.1.0
 - printer: 0.0.3
 - privacy: 1.3.0
 - provisioning_api: 1.9.0
 - quota_warning: 1.8.0
 - recommendations: 0.7.0
 - registration: 0.5.0
 - richdocuments: 3.7.4
 - richdocumentscode_arm64: 4.2.800
 - scanner: 0.1.9
 - serverinfo: 1.9.0
 - settings: 1.1.0
 - sharebymail: 1.9.0
 - social: 0.3.1
 - sociallogin: 3.2.8
 - socialsharing_diaspora: 2.1.0
 - socialsharing_email: 2.1.0
 - socialsharing_facebook: 2.1.0
 - socialsharing_twitter: 2.1.0
 - spreed: 9.0.3
 - support: 1.2.1
 - survey_client: 1.7.0
 - systemtags: 1.9.0
 - tasks: 0.13.3
 - terms_of_service: 1.5.1
 - text: 3.0.1
 - theming: 1.10.0
 - timemanager: 0.1.4
 - transmission: 0.6.0
 - twofactor_admin: 3.0.0
 - twofactor_backupcodes: 1.8.0
 - twofactor_gateway: 0.17.0
 - twofactor_nextcloud_notification: 2.3.0
 - twofactor_totp: 5.0.0
 - twofactor_u2f: 6.0.0
 - twofactor_webauthn: 0.2.5
 - updatenotification: 1.9.0
 - user_external: 0.10.0
 - user_ldap: 1.9.0
 - user_saml: 3.2.0
 - video_converter: 0.1.4
 - viewer: 1.3.0
 - weather: 1.7.3
 - webapppassword: 20.8.6
 - workflow_pdf_converter: 1.4.0
 - workflowengine: 2.1.0
Disabled:
 - flowupload
 - loganalyzer

Configuration (config/config.php)
{
    "instanceid": "***REMOVED SENSITIVE VALUE***",
    "passwordsalt": "***REMOVED SENSITIVE VALUE***",
    "secret": "***REMOVED SENSITIVE VALUE***",
    "overwrite.cli.url": "https:\/\/shuvi.ddns.net",
    "htaccess.RewriteBase": "\/",
    "trusted_domains": [
        "shuvi.ddns.net"
    ],
    "logtimezone": "Europe\/Berlin",
    "datadirectory": "***REMOVED SENSITIVE VALUE***",
    "dbtype": "mysql",
    "version": "19.0.3.1",
    "dbname": "***REMOVED SENSITIVE VALUE***",
    "dbhost": "***REMOVED SENSITIVE VALUE***",
    "dbport": "",
    "dbtableprefix": "oc_",
    "mysql.utf8mb4": true,
    "dbuser": "***REMOVED SENSITIVE VALUE***",
    "dbpassword": "***REMOVED SENSITIVE VALUE***",
    "installed": true,
    "allow_local_remote_servers": true,
    "memcache.local": "\\OC\\Memcache\\APCu",
    "memcache.distributed": "\\OC\\Memcache\\Redis",
    "redis": {
        "host": "***REMOVED SENSITIVE VALUE***",
        "port": 6379
    },
    "memcache.locking": "\\OC\\Memcache\\Redis",
    "updater.release.channel": "stable",
    "app_install_overwrite": [
        "dashboard"
    ],
    "mail_smtpmode": "smtp",
    "mail_smtpsecure": "tls",
    "mail_sendmailmode": "smtp",
    "mail_from_address": "***REMOVED SENSITIVE VALUE***",
    "mail_domain": "***REMOVED SENSITIVE VALUE***",
    "mail_smtpauthtype": "PLAIN",
    "mail_smtpauth": 1,
    "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
    "mail_smtpport": "587",
    "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
    "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
    "ldapIgnoreNamingRules": false,
    "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory"
}

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

Are you using encryption:

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

LDAP configuration (delete this par if not used)
background_sync_interval: 1800enabled: yesinstalled_version: 1.9.0s01_lastChange: 1600094936s01has_memberof_filter_support: 0s01home_folder_naming_rule: s01last_jpegPhoto_lookup: 0s01ldap_agent_password: s01ldap_attributes_for_group_search: s01ldap_attributes_for_user_search: s01ldap_backup_host: s01ldap_backup_port: s01ldap_base: s01ldap_base_groups: s01ldap_base_users: s01ldap_cache_ttl: 600s01ldap_configuration_active: 0s01ldap_default_ppolicy_dn: s01ldap_display_name: displayNames01ldap_dn: s01ldap_dynamic_group_member_url: s01ldap_email_attr: s01ldap_experienced_admin: 0s01ldap_expert_username_attr: s01ldap_expert_uuid_group_attr: s01ldap_expert_uuid_user_attr: s01ldap_ext_storage_home_attribute: s01ldap_gid_number: gidNumbers01ldap_group_display_name: cns01ldap_group_filter: s01ldap_group_filter_mode: 0s01ldap_group_member_assoc_attribute: s01ldap_groupfilter_groups: s01ldap_groupfilter_objectclass: s01ldap_host: s01ldap_login_filter: s01ldap_login_filter_mode: 0s01ldap_loginfilter_attributes: s01ldap_loginfilter_email: 0s01ldap_loginfilter_username: 1s01ldap_matching_rule_in_chain_state: unknowns01ldap_nested_groups: 0s01ldap_override_main_server: s01ldap_paging_size: 500s01ldap_port: s01ldap_quota_attr: s01ldap_quota_def: s01ldap_tls: 0s01ldap_turn_off_cert_check: 0s01ldap_turn_on_pwd_change: 0s01ldap_user_avatar_rule: defaults01ldap_user_display_name_2: s01ldap_user_filter_mode: 0s01ldap_userfilter_groups: s01ldap_userfilter_objectclass: s01ldap_userlist_filter: s01use_memberof_to_detect_membership: 1types: authentication

Client configuration

Browser: Chrome/85.0.4183.102

Operating system: Win10

Logs

Web server error log
/var/log/nginx/error.log

2020/09/15 14:52:07 [error] 1953#1953: *8411 upstream timed out (110: Connection                                                                                                              timed out) while reading response header from upstream, client: 109.41.129.224,                                                                                                              server: shuvi.ddns.net, request: "POST /settings/apps/enable HTTP/2.0", upstrea                                                                                                             m: "fastcgi://127.0.0.1:9000", host: "shuvi.ddns.net"

Nextcloud log
[PHP] Error: filesize(): stat failed for /media/HDD1/nextcloud/Philipp/files/SofortUpload/00001.vcf.ocTransferId471004676.part at /var/www/nextcloud/lib/private/LargeFileHelper.php#173

PUT /remote.php/webdav/SofortUpload/00001.vcf
from 109.41.129.224 by Philipp at 2020-09-15T15:15:14+02:00
2 Likes

Hi @Senpai ,

It might not be a real issue, but I’m not sure about that.
I believe what is happening here is:

  • when you upload the file 00001.vcf it gets uploaded as 00001.vcf.ocTransferId471004676.part (in order to continue the upload in case of a disconnect I guess)
  • NC is trying to get the file size when the file got already renamed back to 00001.vcf
  • therefore the function to determine the file size trys to access the temporary file which does not longer exist (as it was renamed)

This could probably still be improved so that the filesize function is called on the part file before it is renamed or something like that.
I think it is best to open a github issue:

Could you do me a favor and also mention my issue as well :sweat_smile::

[PHP] Error: filesize(): stat failed for /var/ncdata/[USER]/files/my_document.xlsx.ocTransferId793365080.part at /var/www/nextcloud/lib/private/Files/Storage/Local.php#224

PUT /remote.php/dav/files/[USER]/files/my_document.xlsx
from 123.123.123.195 by [USER] at 2020-10-02T10:22:22+02:00

For the other users maybe stumbling over this issue and this thread, could you also post the URL to your github issue then?