core icon indicating copy to clipboard operation
core copied to clipboard

Owncloud error when delete empty folder in smb folder on external storage

Open lep86 opened this issue 10 years ago • 12 comments

Steps to reproduce

  1. Add SMB external storage with any Authentication method
  2. Share folder on that storage and Available for any User
  3. Log in ownclound like a user
  4. Log in SMB shared folder
  5. Create empty folder in smb folder
  6. Delete that empty folder
  7. Get error "Error deleting file "owncloudtest""

Expected behaviour

Folder in SMB folder delete and not get error "Error deleting file "owncloudtest""

Actual behaviour

When you delete any folder in the SMB folder icons remain, but in fact the folder in your shopping cart. this does not happen with the files, and if folder not emty Owncloud wrote a critical error in log. In user interface i got "Error deleting file "owncloudtest""

Server configuration

Operating system: Ubuntu 15.10 Web server: Apache 2.4.12 Database: Mysql5.7 PHP version: PHP 5.6.11 ownCloud version: (see ownCloud admin page) 9.1 Updated from an older ownCloud or fresh install: Update from 9.0.2 Where did you install ownCloud from: https://download.owncloud.org/download/repositories/stable/owncloud/ Signing status (ownCloud 9.0 and above):

Technical information

The following list covers which files have failed the integrity check. Please read the previous linked documentation to learn more about the errors and how to fix them.

Results

  • core
    • EXTRA_FILE
      • .config.swp

Raw output

Array ( [core] => Array ( [EXTRA_FILE] => Array ( [.config.swp] => Array ( [expected] => [current] => 8d4dba41d0bd7caaca457327901b6cd20552a745b5fc351644aebf2468ca999db58b0bc24b382c7875732b7c151ed0aaddc292baa757b1daec10e5eb5a86b7ad )

            )

    )

) List of activated apps: Enabled:

  • Activity: 2.3.2
  • comments: 0.3.0
  • dav: 0.2.5
  • external: 1.2
  • federatedfilesharing: 03.0
  • Federation: 0.1.0
  • Files: 1.5.1
  • Files_external: 0.6.0
  • Files_pdfviewer: 0.8.1
  • Files_sharing: 0.10.0
  • Files_texteditor: 2.1
  • Files_trashbin: 0.9.0
  • Files_versions: 1.3.0
  • Files_videoplayer: 0.9.8
  • Firstrunwizzard: 1.1
  • gallery: 15.0.0
  • notifications: 0.3.0
  • provision_api: 0.5.0
  • systemtags: 0.3.0
  • templateeditor: 0.1
  • updatenotification: 0.2.1
  • user_externak: 0.4
  • uer_ldap: 0.9.0

The content of config/config.php: can't add Are you using external storage, if yes which one: local/smb Are you using encryption: no Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory

Client configuration

Browser: any Operating system: any

Logs

Web server error log

cant Insert your webserver log here cant

ownCloud log (data/owncloud.log)

Exception: {"Message":"Unknown error (NT_STATUS_DELETE_PENDING) for /owncloudtest","Exception":"Icewind\SMB\Exception\Exception","Code":0,"Trace":"#0 /var/www/owncloud/apps/files_external/3rdparty/icewind/smb/src/Share.php(398): Icewind\SMB\Parser->checkForError(Array, '/owncloudtest')\n#1 /var/www/owncloud/apps/files_external/3rdparty/icewind/smb/src/Share.php(140): Icewind\SMB\Share->parseOutput(Array, '/owncloudtest')\n#2 /var/www/owncloud/apps/files_external/lib/Lib/Storage/SMB.php(115): Icewind\SMB\Share->stat('/owncloudtest')\n#3 /var/www/owncloud/apps/files_external/lib/Lib/Storage/SMB.php(361): OCA\Files_External\Lib\Storage\SMB->getFileInfo('owncloudtest')\n#4 /var/www/owncloud/lib/private/Files/Storage/Wrapper/Wrapper.php(219): OCA\Files_External\Lib\Storage\SMB->file_exists('owncloudtest')\n#5 /var/www/owncloud/lib/private/Files/Storage/Wrapper/Availability.php(240): OC\Files\Storage\Wrapper\Wrapper->file_exists('owncloudtest')\n#6 /var/www/owncloud/lib/private/Files/Storage/Wrapper/Wrapper.php(219): OC\Files\Storage\Wrapper\Availability->file_exists('owncloudtest')\n#7 /var/www/owncloud/lib/private/Files/Storage/Wrapper/Wrapper.php(219): OC\Files\Storage\Wrapper\Wrapper->file_exists('owncloudtest')\n#8 /var/www/owncloud/apps/files_trashbin/lib/Trashbin.php(245): OC\Files\Storage\Wrapper\Wrapper->file_exists('owncloudtest')\n#9 /var/www/owncloud/apps/files_trashbin/lib/Storage.php(160): OCA\Files_Trashbin\Trashbin::move2trash('files/owncloudt...')\n#10 /var/www/owncloud/apps/files_trashbin/lib/Storage.php(106): OCA\Files_Trashbin\Storage->doDelete('owncloudtest', 'rmdir')\n#11 /var/www/owncloud/lib/private/Files/View.php(1118): OCA\Files_Trashbin\Storage->rmdir('owncloudtest')\n#12 /var/www/owncloud/lib/private/Files/View.php(340): OC\Files\View->basicOperation('rmdir', '/files/owncloud...', Array)\n#13 /var/www/owncloud/apps/dav/lib/Connector/Sabre/Directory.php(276): OC\Files\View->rmdir('/files/owncloud...')\n#14 /var/www/owncloud/3rdparty/sabre/dav/lib/DAV/Tree.php(179): OCA\DAV\Connector\Sabre\Directory->delete()\n#15 /var/www/owncloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php(285): Sabre\DAV\Tree->delete('files/owncloudt...')\n#16 [internal function]: Sabre\DAV\CorePlugin->httpDelete(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))\n#17 /var/www/owncloud/3rdparty/sabre/event/lib/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\n#18 /var/www/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php(459): Sabre\Event\EventEmitter->emit('method:DELETE', Array)\n#19 /var/www/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php(248): Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))\n#20 /var/www/owncloud/apps/dav/appinfo/v1/webdav.php(56): Sabre\DAV\Server->exec()\n#21 /var/www/owncloud/remote.php(164): require_once('/var/www/ownclo...')\n#22 {main}","File":"/var/www/owncloud/apps/files_external/3rdparty/icewind/smb/src/Parser.php","Line":74,"User":"Admin"}

Browser log

don't know how to get

lep86 avatar Aug 18 '16 09:08 lep86

@jvillafanez any idea ?

PVince81 avatar Aug 19 '16 08:08 PVince81

I can't reproduce the issue.

I've tried with a fresh install of ownCloud 9.1.0 with php 5.5. Create an empty folder directly in the backend, and the file is correctly deleted.

I've also tried to delete a folder with a hidden read-only file in it, but I get a NT_STATUS_CANNOT_DELETE error (which is normal), not the NT_STATUS_DELETE_PENDING

Looking at the trace, the error happens during the stat call, not during the delete / rmdir call. My guess is that ownCloud sends correctly the rmdir call, the call returns and then we try to verify the file is properly delete checking its existance. It's at this point when we get the error.

@lep86 do you have any software that could be interfering with the folder deletion? I've checked http://superuser.com/questions/234569/windows-7-delayed-file-delete and it could be a possible explanation of what's happening. The link says that the file is deleted from the FS after one or two minutes. Does it happen the same to you? Is the folder deleted after some time?

In addition, it's very useful to know what SMB server are you connecting to, specially to look for solutions.

jvillafanez avatar Aug 19 '16 10:08 jvillafanez

Yes, in fact the folder is deleted. But removing the error gets out. If everything is as you say, why not an empty folder is deleted normally? I use EMC isilon storage. For user data, I use the same repository. But SMB folder сonnected via ubuntu and all delete normaly (folders,files, all).

lep86 avatar Aug 19 '16 11:08 lep86

When you ask ownCloud to delete the folder, it mainly does 2 things: send the delete request and then verify the folder is deleted. This is done by core, not by the external storage implementation. I don't know the reason for that, but I guess that some storages may not be so trusty when you delete something.

So ownCloud send the request, everything seems ok, and then ownCloud verify the file is deleted, but the backend storage (the EMC isilon in your case) answer with a "delete pending" instead of the expected "file doesn't exists".

I guess ubuntu and others just send the delete request and consider the folder deleted even though it's not truly the case.

jvillafanez avatar Aug 19 '16 11:08 jvillafanez

@lep86 could you add a delay in https://github.com/owncloud/core/blob/stable9.1/lib/private/Files/View.php#L345 ? (You can remove it later.)

for example:

......
            $result = false;
        }
sleep(5);
        if (!$result && !$this->file_exists($path)) { //clear ghost files from the cache on delete
            $storage = $mount->getStorage();
......

That would send the delete, wait 5 seconds and then check. You might want to increase the time a bit.

If it works (no error is shown) then definitely something is intefering with the deletion of the folder.

BTW, the comment clear some doubts about why we're checking after removing.

jvillafanez avatar Aug 19 '16 12:08 jvillafanez

Done, but don't work...

Exception: {"Message":"Unknown error (NT_STATUS_DELETE_PENDING) for /cloudsame","Exception":"Icewind\SMB\Exception\Exception","Code":0,"Trace":"#0 /var/www/owncloud/apps/files_external/3rdparty/icewind/smb/src/Share.php(398): Icewind\SMB\Parser->checkForError(Array, '/cloudsame')\n#1 /var/www/owncloud/apps/files_external/3rdparty/icewind/smb/src/Share.php(140): Icewind\SMB\Share->parseOutput(Array, '/cloudsame')\n#2 /var/www/owncloud/apps/files_external/lib/Lib/Storage/SMB.php(115): Icewind\SMB\Share->stat('/cloudsame')\n#3 /var/www/owncloud/apps/files_external/lib/Lib/Storage/SMB.php(361): OCA\Files_External\Lib\Storage\SMB->getFileInfo('cloudsame')\n#4 /var/www/owncloud/lib/private/Files/Storage/Wrapper/Wrapper.php(219): OCA\Files_External\Lib\Storage\SMB->file_exists('cloudsame')\n#5 /var/www/owncloud/lib/private/Files/Storage/Wrapper/Wrapper.php(219): OC\Files\Storage\Wrapper\Wrapper->file_exists('cloudsame')\n#6 /var/www/owncloud/lib/private/Files/Storage/Wrapper/Availability.php(240): OC\Files\Storage\Wrapper\Wrapper->file_exists('cloudsame')\n#7 /var/www/owncloud/lib/private/Files/Storage/Wrapper/Wrapper.php(219): OC\Files\Storage\Wrapper\Availability->file_exists('cloudsame')\n#8 /var/www/owncloud/lib/private/Files/Storage/Wrapper/Wrapper.php(219): OC\Files\Storage\Wrapper\Wrapper->file_exists('cloudsame')\n#9 /var/www/owncloud/apps/files_trashbin/lib/Trashbin.php(245): OC\Files\Storage\Wrapper\Wrapper->file_exists('cloudsame')\n#10 /var/www/owncloud/apps/files_trashbin/lib/Storage.php(160): OCA\Files_Trashbin\Trashbin::move2trash('SMB/cloudsame')\n#11 /var/www/owncloud/apps/files_trashbin/lib/Storage.php(106): OCA\Files_Trashbin\Storage->doDelete('cloudsame', 'rmdir')\n#12 /var/www/owncloud/lib/private/Files/View.php(1118): OCA\Files_Trashbin\Storage->rmdir('cloudsame')\n#13 /var/www/owncloud/lib/private/Files/View.php(340): OC\Files\View->basicOperation('rmdir', '/SMB/cloudsame', Array)\n#14 /var/www/owncloud/apps/dav/lib/Connector/Sabre/Directory.php(276): OC\Files\View->rmdir('/SMB/cloudsame')\n#15 /var/www/owncloud/3rdparty/sabre/dav/lib/DAV/Tree.php(179): OCA\DAV\Connector\Sabre\Directory->delete()\n#16 /var/www/owncloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php(285): Sabre\DAV\Tree->delete('SMB/cloudsame')\n#17 [internal function]: Sabre\DAV\CorePlugin->httpDelete(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))\n#18 /var/www/owncloud/3rdparty/sabre/event/lib/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\n#19 /var/www/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php(459): Sabre\Event\EventEmitter->emit('method:DELETE', Array)\n#20 /var/www/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php(248): Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))\n#21 /var/www/owncloud/apps/dav/appinfo/v1/webdav.php(56): Sabre\DAV\Server->exec()\n#22 /var/www/owncloud/remote.php(164): require_once('/var/www/ownclo...')\n#23 {main}","File":"/var/www/owncloud/apps/files_external/3rdparty/icewind/smb/src/Parser.php","Line":74,"User":"641A845C-9F21-46EB-8627-63F563FF6852"}

lep86 avatar Aug 19 '16 12:08 lep86

upd. that problem for all SMB folder (not only EMC)

lep86 avatar Aug 25 '16 08:08 lep86

Could you check what happens when you try to delete the folder using the smbclient app directly?

smbclient -U 'user%password' '//server/share'
(then delete the folder)

I don't think we can do anything if that is failing too. If the official client isn't working against your SMB server, ownCloud, which is depending on it, won't do better.

Keeping with the assupmtion above, it would be a problem either of the smbclient library or a problem with the SMB server. If possible, I'd suggest to install ubuntu 16.04 and use always the official packages (I guess you're already doing this). I can't say it will work, but at least we should know where the problem is.

jvillafanez avatar Aug 25 '16 10:08 jvillafanez

@lep86 did you try the command?

PVince81 avatar Nov 30 '16 14:11 PVince81

i'm reinstall owncloud to version 9.1.2 and work fine, sry. since when I published the entry took a very long timeю

lep86 avatar Dec 01 '16 03:12 lep86

Ok cool, good to hear it works now

PVince81 avatar Dec 01 '16 10:12 PVince81

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.

lock[bot] avatar Aug 03 '19 06:08 lock[bot]