Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

403 Forbidden when DELETE file #23532

Closed
binarykitchen opened this issue Mar 23, 2016 · 8 comments
Closed

403 Forbidden when DELETE file #23532

binarykitchen opened this issue Mar 23, 2016 · 8 comments

Comments

@binarykitchen
Copy link

Steps to reproduce

Trying to delete a file. This DELETE request:
https://aaa.bbb.ccc/remote.php/webdav/M1/home/michael-heuberger/Documents/app_4_residence_cov_letter.odt

Expected behaviour

Successfully delete that file

Actual behaviour

Can't delete it. A 403 Forbidden is returned

Furthermore I see those log entries. They indicate a locking issue. Not sure if this is related:

{"reqId":"iAP83khl4ggtUzvg4MbZ","remoteAddr":"58.28.152.233","app":"webdav","message":"Exception: {\"Message\":\"HTTP\\\/1.1 423 \\\"M1\\\/home\\\/michael-heuberger\\\/Documents\\\/app_4_residence_cov_letter.odt\\\" is locked\",\"Exception\":\"OCA\\\\DAV\\\\Connector\\\\Sabre\\\\Exception\\\\FileLocked\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Tree.php(179): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\File->delete()\\n#1 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(287): Sabre\\\\DAV\\\\Tree->delete('M1\\\/home\\\/michael...')\\n#2 [internal function]: Sabre\\\\DAV\\\\CorePlugin->httpDelete(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#3 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#4 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(459): Sabre\\\\Event\\\\EventEmitter->emit('method:DELETE', Array)\\n#5 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(248): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#6 \\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(55): Sabre\\\\DAV\\\\Server->exec()\\n#7 \\\/var\\\/www\\\/owncloud\\\/remote.php(138): require_once('\\\/var\\\/www\\\/ownclo...')\\n#8 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/connector\\\/sabre\\\/file.php\",\"Line\":342,\"User\":\"xxx\"}","level":4,"time":"2016-03-23T05:28:21+00:00"}
{"reqId":"ADbY4DGu62x8Fpchu\/17","remoteAddr":"58.28.152.233","app":"webdav","message":"Exception: {\"Message\":\"An exception occurred while executing 'INSERT INTO `oc_file_locks` (`key`,`lock`,`ttl`) SELECT ?,?,? FROM `oc_file_locks` WHERE `key` = ? HAVING COUNT(*) = 0' with params [\\\"files\\\\\\\/c61e426861fcd34d744543f5284d396f\\\", 1, 1458723682, \\\"files\\\\\\\/c61e426861fcd34d744543f5284d396f\\\"]:\\n\\nSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'files\\\/c61e426861fcd34d744543f5284d396f' for key 'lock_key_index'\",\"Exception\":\"Doctrine\\\\DBAL\\\\Exception\\\\UniqueConstraintViolationException\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/DBALException.php(116): Doctrine\\\\DBAL\\\\Driver\\\\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException))\\n#1 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Connection.php(996): Doctrine\\\\DBAL\\\\DBALException::driverExceptionDuringQuery(Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOMySql\\\\Driver), Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException), 'INSERT INTO `oc...', Array)\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/db\\\/connection.php(205): Doctrine\\\\DBAL\\\\Connection->executeUpdate('INSERT INTO `oc...', Array, Array)\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/db\\\/adapter.php(93): OC\\\\DB\\\\Connection->executeUpdate('INSERT INTO `*P...', Array)\\n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/db\\\/connection.php(243): OC\\\\DB\\\\Adapter->insertIfNotExist('*PREFIX*file_lo...', Array, Array)\\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/lock\\\/dblockingprovider.php(113): OC\\\\DB\\\\Connection->insertIfNotExist('*PREFIX*file_lo...', Array, Array)\\n#6 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/lock\\\/dblockingprovider.php(158): OC\\\\Lock\\\\DBLockingProvider->initLockField('files\\\/c61e42686...', 1)\\n#7 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/common.php(663): OC\\\\Lock\\\\DBLockingProvider->acquireLock('files\\\/c61e42686...', 1)\\n#8 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/wrapper\\\/wrapper.php(577): OC\\\\Files\\\\Storage\\\\Common->acquireLock('files\\\/M1\\\/home\\\/m...', 1, Object(OC\\\\Lock\\\\DBLockingProvider))\\n#9 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/wrapper\\\/wrapper.php(577): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->acquireLock('files\\\/M1\\\/home\\\/m...', 1, Object(OC\\\\Lock\\\\DBLockingProvider))\\n#10 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/view.php(1850): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->acquireLock('files\\\/M1\\\/home\\\/m...', 1, Object(OC\\\\Lock\\\\DBLockingProvider))\\n#11 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/view.php(1956): OC\\\\Files\\\\View->lockPath('\\\/M1\\\/home\\\/michae...', 1)\\n#12 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/view.php(1230): OC\\\\Files\\\\View->lockFile('M1\\\/home\\\/michael...', 1)\\n#13 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/files\\\/view.php(1277): OC\\\\Files\\\\View->getCacheEntry(Object(OCA\\\\Files_Trashbin\\\\Storage), 'files\\\/M1\\\/home\\\/m...', 'M1\\\/home\\\/michael...')\\n#14 \\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/connector\\\/sabre\\\/objecttree.php(155): OC\\\\Files\\\\View->getFileInfo('M1\\\/home\\\/michael...')\\n#15 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(726): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\ObjectTree->getNodeForPath('M1\\\/home\\\/michael...')\\n#16 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(624): Sabre\\\\DAV\\\\Server->getCopyAndMoveInfo(Object(Sabre\\\\HTTP\\\\Request))\\n#17 [internal function]: Sabre\\\\DAV\\\\CorePlugin->httpMove(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:MOVE', 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(55): Sabre\\\\DAV\\\\Server->exec()\\n#22 \\\/var\\\/www\\\/owncloud\\\/remote.php(138): require_once('\\\/var\\\/www\\\/ownclo...')\\n#23 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Driver\\\/AbstractMySQLDriver.php\",\"Line\":66,\"User\":\"xxx\"}","level":4,"time":"2016-03-23T08:01:22+00:00"}

Server configuration

$   
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.3 LTS
Release:        14.04
Codename:       trusty
$ uname -a                                                                                                                                                                                                                            
Linux binarykitchen.com 4.1.17-rh17.xenU #1 SMP Tue Feb 9 02:59:53 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Web server:

$ nginx -v
nginx version: nginx/1.8.1

Database:

$ mysql --version
mysql  Ver 14.14 Distrib 5.5.47, for debian-linux-gnu (x86_64) using readline 6.3

PHP version:

$ php -v                                                                                                                                                                                                                              
PHP 5.5.31-2+deb.sury.org~trusty+1 (cli) (built: Jan 14 2016 18:30:24) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

ownCloud version:

$ sudo -u www-data php occ status                                                                                                                                                                                                     
  - installed: true
  - version: 9.0.0.19
  - versionstring: 9.0.0
  - edition: 

Updated from an older ownCloud or fresh install:
Fresh install via apt-get

$ sudo -u www-data php ./occ app:list                                                                                                                                                                                                 
Enabled:
  - activity: 2.2.1
  - calendar: 1.0
  - comments: 0.2
  - contacts: 1.0.0.0
  - dav: 0.1.5
  - documents: 0.12.0
  - encryption: 1.2.0
  - external: 1.2
  - federatedfilesharing: 0.1.0
  - federation: 0.0.4
  - files: 1.4.4
  - files_pdfviewer: 0.8
  - files_sharing: 0.9.1
  - files_texteditor: 2.1
  - files_trashbin: 0.8.0
  - files_versions: 1.2.0
  - files_videoplayer: 0.9.8
  - gallery: 14.5.0
  - music: 0.3.10
  - notes: 2.0.0
  - notifications: 0.2.3
  - provisioning_api: 0.4.1
  - search_lucene: 0.7.0
  - systemtags: 0.2
  - tasks: 0.9.0
  - templateeditor: 0.1
  - updatenotification: 0.1.0
Disabled:
  - files_external
  - firstrunwizard
  - user_external
  - user_ldap

The content of config/config.php: (Without sensitive data)

<?php
$CONFIG = array (
  'instanceid' => 'xxx',
  'passwordsalt' => 'xxx',
  'datadirectory' => '/var/www/owncloud/data',
  'dbtype' => 'mysql',
  'version' => '9.0.0.19',
  'dbname' => 'owncloud',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'owncloud',
  'dbpassword' => 'xxx',
  'installed' => true,
  'forcessl' => true,
  'loglevel' => 2,
  'logfile' => '/var/log/owncloud.log',
  'theme' => '',
  'maintenance' => false,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'trusted_domains' => 
  array (
    0 => 'xxx',
  ),
  'mail_smtpmode' => 'smtp',
  'secret' => 'xxx',
  'forceSSLforSubdomains' => true,
  'mail_smtpsecure' => 'tls',
  'mail_smtphost' => '127.0.0.1',
  'mail_smtpport' => '587',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'xxx',
  'mail_smtppassword' => 'xxx',
  'mail_smtpauthtype' => 'PLAIN',
  'trashbin_retention_obligation' => 'auto',
  'updatechecker' => false,
);

Are you using external storage, if yes which one:
None

Client configuration

Thunderbird 38.5.1

Operating system:
Ubuntu 15.10

Logs

Web server error log

N/A

ownCloud log (data/owncloud.log)

See above

Browser log

Irrelevant

@LukasReschke
Copy link
Member

{"reqId":"ADbY4DGu62x8Fpchu/17","remoteAddr":"58.28.152.233","app":"webdav","message":"Exception: {"Message":"An exception occurred while executing 'INSERT INTO oc_file_locks (key,lock,ttl) SELECT ?,?,? FROM oc_file_locks WHERE key = ? HAVING COUNT(_) = 0' with params [\"files\\/c61e426861fcd34d744543f5284d396f\", 1, 1458723682, \"files\\/c61e426861fcd34d744543f5284d396f\"]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'files\/c61e426861fcd34d744543f5284d396f' for key 'lock_key_index'","Exception":"Doctrine\DBAL\Exception\UniqueConstraintViolationException","Code":0,"Trace":"#0 \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/DBALException.php(116): Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\DBAL\Driver\PDOException))\n#1 \/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php(996): Doctrine\DBAL\DBALException::driverExceptionDuringQuery(Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Driver\PDOException), 'INSERT INTO oc...', Array)\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/db\\\/connection.php(205): Doctrine\\\\DBAL\\\\Connection->executeUpdate('INSERT INTOoc...', Array, Array)\n#3 \/var\/www\/owncloud\/lib\/private\/db\/adapter.php(93): OC\DB\Connection->executeUpdate('INSERT INTO `_P...', Array)\n#4 \/var\/www\/owncloud\/lib\/private\/db\/connection.php(243): OC\DB\Adapter->insertIfNotExist('_PREFIX_file_lo...', Array, Array)\n#5 \/var\/www\/owncloud\/lib\/private\/lock\/dblockingprovider.php(113): OC\DB\Connection->insertIfNotExist('_PREFIX_file_lo...', Array, Array)\n#6 \/var\/www\/owncloud\/lib\/private\/lock\/dblockingprovider.php(158): OC\Lock\DBLockingProvider->initLockField('files\/c61e42686...', 1)\n#7 \/var\/www\/owncloud\/lib\/private\/files\/storage\/common.php(663): OC\Lock\DBLockingProvider->acquireLock('files\/c61e42686...', 1)\n#8 \/var\/www\/owncloud\/lib\/private\/files\/storage\/wrapper\/wrapper.php(577): OC\Files\Storage\Common->acquireLock('files\/M1\/home\/m...', 1, Object(OC\Lock\DBLockingProvider))\n#9 \/var\/www\/owncloud\/lib\/private\/files\/storage\/wrapper\/wrapper.php(577): OC\Files\Storage\Wrapper\Wrapper->acquireLock('files\/M1\/home\/m...', 1, Object(OC\Lock\DBLockingProvider))\n#10 \/var\/www\/owncloud\/lib\/private\/files\/view.php(1850): OC\Files\Storage\Wrapper\Wrapper->acquireLock('files\/M1\/home\/m...', 1, Object(OC\Lock\DBLockingProvider))\n#11 \/var\/www\/owncloud\/lib\/private\/files\/view.php(1956): OC\Files\View->lockPath('\/M1\/home\/michae...', 1)\n#12 \/var\/www\/owncloud\/lib\/private\/files\/view.php(1230): OC\Files\View->lockFile('M1\/home\/michael...', 1)\n#13 \/var\/www\/owncloud\/lib\/private\/files\/view.php(1277): OC\Files\View->getCacheEntry(Object(OCA\Files_Trashbin\Storage), 'files\/M1\/home\/m...', 'M1\/home\/michael...')\n#14 \/var\/www\/owncloud\/apps\/dav\/lib\/connector\/sabre\/objecttree.php(155): OC\Files\View->getFileInfo('M1\/home\/michael...')\n#15 \/var\/www\/owncloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php(726): OCA\DAV\Connector\Sabre\ObjectTree->getNodeForPath('M1\/home\/michael...')\n#16 \/var\/www\/owncloud\/3rdparty\/sabre\/dav\/lib\/DAV\/CorePlugin.php(624): Sabre\DAV\Server->getCopyAndMoveInfo(Object(Sabre\HTTP\Request))\n#17 [internal function]: Sabre\DAV\CorePlugin->httpMove(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:MOVE', 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(55): Sabre\DAV\Server->exec()\n#22 \/var\/www\/owncloud\/remote.php(138): require_once('\/var\/www\/ownclo...')\n#23 {main}","File":"\/var\/www\/owncloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/AbstractMySQLDriver.php","Line":66,"User":"xxx"}","level":4,"time":"2016-03-23T08:01:22+00:00"}

@icewind1991 @PVince81 Any ideas?

@LukasReschke LukasReschke added this to the 9.0.2-next-maintenance milestone Mar 24, 2016
@PVince81
Copy link
Contributor

@binarykitchen is this repeatable or only happened once ?

@binarykitchen
Copy link
Author

wiederholbar!

On 24/03/2016, at 22:19, Vincent Petry notifications@github.com wrote:

@binarykitchen is this repeatable or only happened once ?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

@PVince81
Copy link
Contributor

assuming repeatable for the same file then, not different files

@ultimatejedi
Copy link

I am experiencing the same issue. I had the issue with version 8.1 and upgraded to 9.0 today. Still unable to delete files from the web interface. I can delete them from the server itself and can delete it from a PC with a sync tool. But when I try in the web interface, it pops up in a yellow box that says "Error deleting files". I have also setup a new server from scratch in preparation for a migration. It also has the same issue. I get a log entry very similar to the original poster. I would appreciate any additional help.

@ghost ghost modified the milestones: 9.0.3-next-maintenance, 9.0.2-current-maintenance Apr 14, 2016
@PVince81
Copy link
Contributor

It might happen if there is a discrepancy between the "oc_filecache" table and the actual files on-disk.

Please check select * from oc_filecache where path like '%undeletablefile%' then check in your data folder whether the file exists and matches the cache contents.

If not, try running occ files:scan --all to repair it.

@binarykitchen
Copy link
Author

perfect, that worked. thanks!

@lock
Copy link

lock bot commented Aug 5, 2019

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 lock bot locked as resolved and limited conversation to collaborators Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants