Skip to content

Webdav: Could not rename part file to final file due to Quota limit #29103

Closed

Description

@htwsaaraub

Steps to reproduce

  1. Connect to Owncloud WebDav with Windows Explorer Map Network Drive
  2. Use https://owncloud.local/remote.php/dav/files/USERNAME/
  3. Try to Copy a File to a Owncloud Directory witch is a External SMB Share

Expected behaviour

The User Quota is set to 1MB. The File to Copy is bigger than the Quota. With Files smaler than the Quota it Works as Expected, but not for bigger Files

There should be a Option for Owncloud Configuration to not Apply Quota to External SMB Shares.
For SMB Shares the Quota of the Windows Server should be the only reasonable Quota.

Actual behaviour

Windows Trys to Upload the File, but the Message appears: Could not read from Sorce or Destination

Server configuration

Operating system: Debian 4.9.30-2+deb9u3 (2017-08-06) x86_64

Web server: Apache/2.4.25 (Debian)

Database: Ver 15.1 Distrib 10.1.23-MariaDB

PHP version: PHP Version 5.6.30-0+deb8u1

ownCloud version: 10.0.3 (stable)

Updated from an older ownCloud or fresh install: Upgrade from 10.0.2

Where did you install ownCloud from: Debian Packages

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

Are you using encryption: no

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

Client configuration

Browser: Google Chrome Version 60.0.3112.113

Operating system: Windows 10 Version 1703 (Build 15063.632)

Logs

Web server error log

134.96.211.82 - - [27/Sep/2017:09:36:11 +0200] "HEAD /remote.php/dav/files/Sven.Schneider/Tausch/UPDATE_INFO.PDF HTTP/1.1" 401 745 "-" "Microsoft-WebDAV-MiniRedir/10.0.15063"
134.96.211.82 - Sven.Schneider [27/Sep/2017:09:36:11 +0200] "HEAD /remote.php/dav/files/Sven.Schneider/Tausch/UPDATE_INFO.PDF HTTP/1.1" 200 953 "-" "Microsoft-WebDAV-MiniRedir/10.0.15063"
134.96.211.82 - Sven.Schneider [27/Sep/2017:09:36:12 +0200] "PUT /remote.php/dav/files/Sven.Schneider/Tausch/UPDATE_INFO.PDF HTTP/1.1" 500 910 "-" "Microsoft-WebDAV-MiniRedir/10.0.15063"
134.96.211.82 - Sven.Schneider [27/Sep/2017:09:36:13 +0200] "DELETE /remote.php/dav/files/Sven.Schneider/Tausch/UPDATE_INFO.PDF HTTP/1.1" 204 685 "-" "Microsoft-WebDAV-MiniRedir/10.0.15063"

ownCloud log (data/owncloud.log)

{"reqId":"1mZJzSwHluxXhiTx1DnV","level":3,"time":"2017-09-27T07:28:06+00:00","remoteAddr":"134.96.211.82","user":"Sven.Schneider","app":"webdav","method":"PUT","url":"\/remote.php\/dav\/files\/Sven.Schneider\/Tausch\/Scan\/UPDATE_INFO.PDF","message":"renaming part file to final file failed"}
{"reqId":"1mZJzSwHluxXhiTx1DnV","level":4,"time":"2017-09-27T07:28:06+00:00","remoteAddr":"134.96.211.82","user":"Sven.Schneider","app":"webdav","method":"PUT","url":"\/remote.php\/dav\/files\/Sven.Schneider\/Tausch\/Scan\/UPDATE_INFO.PDF","message":"Exception: {\"Message\":\"HTTP\\\/1.1 500 Could not rename part file to final file\",\"Exception\":\"Sabre\\\\DAV\\\\Exception\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(1129): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\File->put(Resource id #66)\\n#1 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(513): Sabre\\\\DAV\\\\Server->updateFile('files\\\/Sven.Schn...', Resource id #66, NULL)\\n#2 [internal function]: Sabre\\\\DAV\\\\CorePlugin->httpPut(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(479): Sabre\\\\Event\\\\EventEmitter->emit('method:PUT', Array)\\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#6 \\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Server.php(234): Sabre\\\\DAV\\\\Server->exec()\\n#7 \\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/v2\\\/remote.php(31): OCA\\\\DAV\\\\Server->exec()\\n#8 \\\/var\\\/www\\\/owncloud\\\/remote.php(165): require_once('\\\/var\\\/www\\\/ownclo...')\\n#9 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/File.php\",\"Line\":212,\"User\":\"Sven.Schneider\"}"}

Activity

  1. PVince81 commented on Oct 9, 2017

    @PVince81
    Contributor

    By default the quota should never be applied to external storages. This is likely another bug / regression 😦

  2. self-assigned this
    on Oct 9, 2017
  3. added this to the development milestone on Oct 9, 2017
  4. PVince81 commented on Oct 10, 2017

    @PVince81
    Contributor

    I wrote an automated test here #29193 but it seems to work fine with quota and external storage.

    Will need further investigation and manual reproduction.

    @htwsaaraub mind posting your config.php in an anonymized form ?

  5. htwsaaraub commented on Oct 11, 2017

    @htwsaaraub
    Author

    @PVince81 Here is my config.php

    $CONFIG = array (
    'instanceid' => 'XXX',
    'passwordsalt' => 'XXX',
    'trusted_domains' =>
    array (
    0 => 'XXX.XXX.XXX.XXX',
    1 => 'name.domain.de',
    ),
    'skeletondirectory' => '',
    'datadirectory' => '/var/www/owncloud/data',
    'dbtype' => 'mysql',
    'version' => '10.0.3.3',
    'dbname' => 'owncloud',
    'dbhost' => '127.0.0.1',
    'dbtableprefix' => 'oc_',
    'dbuser' => 'XXX',
    'dbpassword' => 'XXX',
    'installed' => true,
    'ldapIgnoreNamingRules' => false,
    'theme' => 'htwsaar',
    'maintenance' => false,
    'forcessl' => true,
    'loglevel' => '3',
    'activity_expire_days' => 180,
    'preview_max_x' => 100,
    'preview_max_y' => 100,
    'enable_previews' => false,
    'preview_max_scale_factor' => 1,
    'log_rotate_size' => 104857600,
    'secret' => 'XXX',
    'asset-pipeline.enabled' => true,
    'trashbin_retention_obligation' => '30, auto',
    'filelocking.enabled' => 'true',
    'memcache.local' => '\OC\Memcache\Redis',
    'memcache.distributed' => '\OC\Memcache\Redis',
    'memcache.locking' => '\OC\Memcache\Redis',
    'redis' =>
    array (
    'host' => 'localhost',
    'port' => 6379,
    'timeout' => 0,
    'dbindex' => 0,
    ),
    'updatechecker' => false,
    );

  6. PVince81 commented on Oct 12, 2017

    @PVince81
    Contributor

    I could not reproduce this issue:

    1. Setup v10.0.3
    2. Login as admin
    3. Setup a SMB storage and mount it to "/smb" for all users
    4. Set the quota for the admin to "1 MB"
    5. Using a Webdav client (I used cadaver), connect to "remote.php/dav/admin/smb"
    6. PUT a file bigger than 1 MB to this location

    The file is uploaded properly.

    And now I also tested with the ownCloud desktop client and uploading a 100 MB file (chunking) to "/smb" works fine.
    And with the web UI the big file works fine too.

    I don't think this is related to quota but maybe a problem with renaming files on an SMB external storage. Can you try directly renaming a file through Webdav (that Windows mount) to a different name ?

  7. PVince81 commented on Oct 12, 2017

    @PVince81
    Contributor

    do you have the smbclient PHP module installed and enabled ? (aka php5-libsmbclient)

  8. htwsaaraub commented on Oct 12, 2017

    @htwsaaraub
    Author

    @PVince81 Yes, I use the smbclient PHP module

    libsmbclient:amd64 2:4.5.12+dfsg-2 amd64 shared library for communication with SMB/CIFS servers

    I use the Windows 10 integrated Webdav Client
    Connect to https://xxx.xxx.xxx/remote.php/dav/files/$username
    Quota for the User is set to 1 MB
    Copy a File bigger than the Quota in the User Root Folder immediately throws the Quota exeeded message. (as expected)
    Copy a File bigga than the Quota to ROOT\SMB the Webdav Client tries to upload the File. The Copy Process shows the progress and bevor it'ts completed it throws the Quota exeeded message.

    In the owncloud.log File the following message is logged.

    {"reqId":"mvPp9MqC1dZgvXPkTk7K","level":3,"time":"2017-10-12T12:51:03+00:00","remoteAddr":"134.96.211.82","user":"Sven.Schneider","app":"webdav","method":"PUT","url":"\/remote.php\/dav\/files\/Sven.Schneider\/Software\/putty-64bit-0.70-installer.msi","message":"renaming part file to final file failed"}
    {"reqId":"mvPp9MqC1dZgvXPkTk7K","level":4,"time":"2017-10-12T12:51:03+00:00","remoteAddr":"134.96.211.82","user":"Sven.Schneider","app":"webdav","method":"PUT","url":"\/remote.php\/dav\/files\/Sven.Schneider\/Software\/putty-64bit-0.70-installer.msi","message":"Exception: {\"Message\":\"HTTP\\\/1.1 500 Could not rename part file to final file\",\"Exception\":\"Sabre\\\\DAV\\\\Exception\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(1129): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\File->put(Resource id #64)\\n#1 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(513): Sabre\\\\DAV\\\\Server->updateFile('files\\\/Sven.Schn...', Resource id #64, NULL)\\n#2 [internal function]: Sabre\\\\DAV\\\\CorePlugin->httpPut(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(479): Sabre\\\\Event\\\\EventEmitter->emit('method:PUT', Array)\\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#6 \\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Server.php(234): Sabre\\\\DAV\\\\Server->exec()\\n#7 \\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/v2\\\/remote.php(31): OCA\\\\DAV\\\\Server->exec()\\n#8 \\\/var\\\/www\\\/owncloud\\\/remote.php(165): require_once('\\\/var\\\/www\\\/ownclo...')\\n#9 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/File.php\",\"Line\":212,\"User\":\"Sven.Schneider\"}"}
    

    Apache Owncloud.log

    [12/Oct/2017:14:50:58 +0200] "PROPFIND /remote.php/dav/files/Sven.Schneider/Software/putty-64bit-0.70-installer.msi HTTP/1.1" 404 1276 "-" "Microsoft-WebDAV-MiniRedir/10.0.15063"
    [12/Oct/2017:14:50:58 +0200] "PUT /remote.php/dav/files/Sven.Schneider/Software/putty-64bit-0.70-installer.msi HTTP/1.1" 201 783 "-" "Microsoft-WebDAV-MiniRedir/10.0.15063"
    [12/Oct/2017:14:50:59 +0200] "LOCK /remote.php/dav/files/Sven.Schneider/Software/putty-64bit-0.70-installer.msi HTTP/1.1" 200 1450 "-" "Microsoft-WebDAV-MiniRedir/10.0.15063"
    [12/Oct/2017:14:51:00 +0200] "PROPPATCH /remote.php/dav/files/Sven.Schneider/Software/putty-64bit-0.70-installer.msi HTTP/1.1" 207 1444 "-" "Microsoft-WebDAV-MiniRedir/10.0.15063"
    [12/Oct/2017:14:51:01 +0200] "HEAD /remote.php/dav/files/Sven.Schneider/Software/putty-64bit-0.70-installer.msi HTTP/1.1" 401 745 "-" "Microsoft-WebDAV-MiniRedir/10.0.15063"
    [12/Oct/2017:14:51:01 +0200] "HEAD /remote.php/dav/files/Sven.Schneider/Software/putty-64bit-0.70-installer.msi HTTP/1.1" 200 1015 "-" "Microsoft-WebDAV-MiniRedir/10.0.15063"
    [12/Oct/2017:14:51:01 +0200] "PUT /remote.php/dav/files/Sven.Schneider/Software/putty-64bit-0.70-installer.msi HTTP/1.1" 500 910 "-" "Microsoft-WebDAV-MiniRedir/10.0.15063"
    [12/Oct/2017:14:51:03 +0200] "DELETE /remote.php/dav/files/Sven.Schneider/Software/putty-64bit-0.70-installer.msi HTTP/1.1" 204 791 "-" "Microsoft-WebDAV-MiniRedir/10.0.15063"
    

    So, the Problem is not Quota, it's renaming files when Uploading with intregrated Windows Webdav Client.
    Renaming existing Files in WebDav works as expected.

  9. PVince81 commented on Oct 13, 2017

    @PVince81
    Contributor

    @htwsaaraub please check that you have the PHP module for libsmbclient. The package you pointed at is the actual C/C++ library but not the PHP wrapper for it. The module can be installed with sudo pecl install smbclient, you might also be able to find a package called php5-libsmbclient or something similar, depending on your sources.

    Still strange that rename works for regular files but not part files.

  10. htwsaaraub commented on Oct 13, 2017

    @htwsaaraub
    Author

    I just installed php-smbclient from Debian Sources via apt.

    php-smbclient amd64 0.8.0-3

    phpinfo:

    libsmbclient Support | enabled
    libsmbclient Version | 0.6.1

    I also Installed smbclient from github
    https://github.com/eduardok/libsmbclient-php

    libsmbclient-php 0.90 installed successfully.
    This smbclient module doesn't show up in php.ini, although extension=smbclient.so is set.

    There is no change in WebDav. Same rename File error as before.

  11. PVince81 commented on Oct 13, 2017

    @PVince81
    Contributor

    @jvillafanez does this ring any bells ? Part file cannot be renamed to final file on SMB storage but regular renames work there.

  12. jvillafanez commented on Oct 16, 2017

    @jvillafanez
    Member

    The exception is thrown in https://github.com/owncloud/core/blob/v10.0.3/apps/dav/lib/Connector/Sabre/File.php#L212

    I suggest to add in the line above the following log for debugging:

    \OCP\Util::writeLog('webdav', 'run -> "' . print_r($run, true) . '" renameok -> "' . print_r($renameOkay, true) . '" file_exists -> "' . print_r($fileExists, true) . '"', \OCP\Util::ERROR);
    

    I expect a log message like:

    run -> "" renameok -> "" file_exists -> ""
    

    with some additional "undefined variable: $renameOk" and "undefined variable: $fileExists"

    If this is the case some pre hook might be causing the failure. You might want to disable non-default apps to track which one is causing problems.

  13. removed their assignment
    on Oct 16, 2017
  14. 10 remaining items

  15. jvillafanez commented on Oct 24, 2017

    @jvillafanez
    Member

    Icewind\SMB\Exception\NotFoundException - code: 2 message: Invalid request for smb

    That's kind of expected because we need to check if the file exists in the SMB server or not, so that exception is under control. The problem is the other one happening during the rename.

    rename swallowing Icewind\\SMB\\Exception\\Exception - code: 22 message: Unknown error (22) for smb:\/\/XXXXX\/Folder\/putty-64bit-0.70-installer.msi
    

    This is quite bad news because I don't know how to reproduce the error nor what could be the cause of it.

    I'm not sure if you've checked already:

    • Does the file uploads through the ownCloud's web UI? windows might be doing some strange things that could affect the outcome of the upload.
    • Does the file uploads through other SMB clients, such as "cadaver" or "smbclient"?

    Maybe a wireshark trace could show some additional information.

  16. htwsaaraub commented on Oct 26, 2017

    @htwsaaraub
    Author

    I have some news.

    The Uploads through the web UI all work like a charm.
    As you suggested I tested some other webdav clients.
    I had the same results (renaming part file to final file failed) with

    • WindowsExplorer WebDav,
    • NetDav3 (which also mounts a WebDav Connection in Windows Explorer)
    • MacOS 10.13 WebDav Connection via Finder. MacOS doesn't throw a error message. Instead leaving a 0 byte File in the WebDav File System.

    For Windows I also tested CarotDAV. This Client doesn't integrate in Windows, instead navigating the WebDAV file System in the Application.
    CarotDAV uploads any File correct. There are no errors in the owncloud log.
    Perhaps this client just ignores the Quota limit, because all other clients have the Same results.

  17. jvillafanez commented on Oct 26, 2017

    @jvillafanez
    Member

    @htwsaaraub could you try with the old webdav endpoint? It should be something like https://owncloud.local/remote.php/webdav/ At least this will shrink the scope.
    If it works then there is definitely a problem with the new webdav endpoint that we'll need to fix.

    Quota limits are handled in the server, so I doubt the CarotDAV has something to do with that. It might be that CarotDAV uploads the whole file at once, but the rest tries to upload the file by chunks (or maybe it's the other way around).
    Web uploads are still using the old webdav endpoint.

  18. htwsaaraub commented on Oct 26, 2017

    @htwsaaraub
    Author

    @jvillafanez Nope, no change. Same results with the old and new endpoint.
    NetDrive3 displays the correct user Quota for both of the Endpoints, but the Quota is always used for External SMB Shares.

  19. jvillafanez commented on Oct 26, 2017

    @jvillafanez
    Member

    I'm out of ideas at the moment 😞
    I'll try to setup something similar in order to properly debug this, but I don't expect to have the environment ready until next week, so if there is no activity ping me in 2 weeks for status.

    If you have any other ideas or more information, feel free to drop by this ticket.

    Meanwhile, you might want to try the ownCloud's desktop client, which I expect to work properly and should provide similar features.

  20. modified the milestones: development, triage on Nov 3, 2017
  21. jvillafanez commented on Nov 15, 2017

    @jvillafanez
    Member

    @htwsaaraub could you test with OC 10.0.4RC1? We've merged something that might solve your issue.

  22. htwsaaraub commented on Dec 15, 2017

    @htwsaaraub
    Author

    @jvillafanez Today I tested the OC 10.0.4 final release.

    I can confirm, webdav is now working as expected. Files on external shares are no longer limited by the quota size.

    For Connections with Windows integrated WebDav client you first have to start the WebClient Service, which isn't set to start Automatic with windows.
    Also I had to set the Connect using different credentials checkbox to connect successful.

    I found a Micorosoft Support Document for Windows 7, which is sill valid under Windows 10.
    https://support.microsoft.com/en-us/help/2560598/-the-folder-you-entered-does-not-appear-to-be-valid--please-choose-ano

  23. PVince81 commented on Dec 15, 2017

    @PVince81
    Contributor

    Glad to hear!

    Case closed then ?

  24. htwsaaraub commented on Dec 15, 2017

    @htwsaaraub
    Author

    Case closed.
    Thanks for your support. 👍

  25. removed this from the triage milestone on Apr 10, 2018
  26. lock commented on Jul 30, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  27. locked as resolved and limited conversation to collaborators on Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions