Repository navigation
Description
I'm using the owncloud app to sync my local files with remote storage.
Steps to reproduce
- Sync some of your folders with a remote files
- Delete a buch of files in the local folder of owncloud directory. In my case I deleted ~900 files.
Expected behaviour
The files should be deleted on the owncloud server without errors.
Actual behaviour
The owncloud server raises timeout errors when deleting the files. I had a timeout of 5 minutes, and modified php-fpm configuration to timeout on 10 and the problem still persits. I belive that 10 minutes to delete a single file is too much and something is wrong.
I can see some deleted files in the deleted files view in the web interface. For example is see that file Imatges/Whatsapp/IMG-20121002-WA0001.jpg is deleted, but as you can see in the log it raises a timeout on the client.
Server configuration
Operating system: Debian 7.8
Web server: Nginx + PHP-FPM
Database: MariaDB 5.5.35
PHP version: PHP 5.4.36
ownCloud version: ownCloud 7.0.4 (stable)
Updated from an older ownCloud or fresh install: Upgraded from an older version
List of activated apps: Activity, Calendar, Contacts, Deleted Files, Documents, First Run Wizard, PDF Viewer, Pictures, Share Files, Text Editor, Updated, Versions, Video Viewer.
The content of config/config.php:
$CONFIG = array (
'instanceid' => 'ocb7caf11ec2',
'passwordsalt' => 'xxxxxxxxxxxx',
'trusted_domains' =>
array (
0 => 'xxxxxxxxxxxx.mydomain.com',
),
'datadirectory' => '/owncloud',
'dbtype' => 'mysql',
'version' => '7.0.4.2',
'dbname' => 'owncloud',
'dbhost' => 'localhost',
'dbtableprefix' => 'oc_',
'dbuser' => 'owncloud',
'dbpassword' => 'password',
'installed' => true,
'forcessl' => true,
'theme' => '',
'maintenance' => false,
'share_folder' => '/Shared',
'mail_from_address' => 'files',
'mail_smtpmode' => 'php',
'mail_domain' => 'mydomain.com',
'secret' => 'xxxxxxxxxxxx',
);
Are you using external storage, if yes which one: No external storage
Are you using encryption: no
Client configuration
Browser: Firefox 35.0.1
Operating system: Linux Mint Rebeca (Ubuntu 14.04)
Mirall version: 1.7.1
Logs
Web server error log
2015/02/09 11:33:32 [error] 20380#0: *1524466 upstream timed out (110: Connection timed out) while reading response header from upstream, client: ZZZ.ZZZ.ZZZ.ZZZ, server: xxx.mydomain.com, request: "DELETE /remote.php/webdav/Imatges/Whatsapp/IMG-20121002-WA0001.jpg HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "xxx.mydomain.com"
There a lot of entries like this.
And in mirall i see the following output:
11.44 Imatges/Whatsapp/IMG-20120929-WA0000.jpg ownCloud 504 Gateway Time-out
ownCloud log (data/owncloud.log)
Nothing relevant on owncloud.log only errors related to mysql restart i have done manually.
Let me know if anything else is required to properly fix the bug.
Activity
pokoli commentedon Feb 9, 2015
Some of the queries running on the mysql database:
Which it seems to have all the heavy load on the server side.
DeepDiver1975 commentedon Feb 9, 2015
We improved delete operation with oc8. Please retest these says after release.
PVince81 commentedon Feb 9, 2015
OC 8 is out, please retest 😄
The problem is that files were copied to trashbin instead of moving. Now in OC 8 they are moved, so should be much faster.
pokoli commentedon Feb 9, 2015
Exactly the same result with oc8
Here is the full server log of sync:
Nevertheless the file file which caused the timeout appears as deleted on the deleted files directory.
PVince81 commentedon Feb 10, 2015
I only see a single "DELETE" operation. Are you saying that this one failed too ?
The issue I mentioned above was when there are lots of files which risk making PHP run into a timeout situation.
If in your case it happens also for single files, then it's another bug. 😦
It looks like it's returning 504 which is "Gateway timeout". Very strange.
pokoli commentedon Feb 10, 2015
All the DELETE operations fail with a timeout on the php backend (php-fpm), so nginx returns the 504 error. php-fpm is configured to kill the process after 10 minutes of running. What I'm saying is that there is something wrong because it lasts 10 minutes to delete a file.
In the other hand, the file which causes the timeout appears correctly on deleted files, but the requests didn't end correctly as it produced the timeout. So it seems that all the work is done correctly, but the requests never ends.
I did delete a lot of files on a previous version (i think it was 6.0) without any problems and the process was quite fast.
Let me know if you need any more info. If you give point to the source code on the delete part i may debug it further to provide more information.
PVince81 commentedon Feb 10, 2015
I see encryption is disabled (which would have slowed down deletion due to share keys handling), so that is ruled out.
Was that file shared with many users ?
PVince81 commentedon Feb 10, 2015
Random shot in the dark: did you at some point have symlinks in your "data" directory ? (because those could cause infinite loops)
pokoli commentedon Feb 10, 2015
The file is not shared. And i checked and no i don't have symlinks.
/owncloud is my data path
PVince81 commentedon Feb 10, 2015
Hmm... still clueless.
Can you maybe try setting "loglevel" to 0 in the config and then run the deletion again ?
And then next try: disable the app "Deleted files" then delete a file. To rule out whether it's related to the trashbin app or something else.
pokoli commentedon Feb 10, 2015
Log with trashbing:
Worked well with trashbin disabled, so it's something related to trashbin.
PVince81 commentedon Feb 10, 2015
Is your trashbin very full ?
Another theory for the slowness is that the trashbin tries to expire old files automatically. If there are many such files, it might be slow. If you have lots of files, you could try and manually empty the trashbin, then try deleting a file again.
CC @schiesbn
pokoli commentedon Feb 10, 2015
Do you think this is very full?
I just selected all files in trashbin and deleted them, i will keep you update when the process ends, but i think it will last some time.
There is some method to empty the trashbin instead of selecting all and delete them?
I was thinking on creating some app to expire files on trashbin after xxx days. Do you think this is interesting for core?
2 remaining items
PVince81 commentedon Feb 10, 2015
Ok thanks for the info.
We should look into improving trashbin expiration performance.
[-]Server timeout when deleting files[/-][+]Trashbin auto-expire causes PHP timeout on delete[/+]PVince81 commentedon Feb 11, 2015
@schiesbn how about auto-expiring as a background job ?
DeepDiver1975 commentedon Feb 11, 2015
the way to go from my understanding - moving the trashbin's expiry hook into a background job should not be that complicated
DeepDiver1975 commentedon Feb 11, 2015
@icewind1991 we did talk about this today - let us know about your progress - THX
icewind1991 commentedon Feb 12, 2015
Looking into added laravel's background queue system to handle this atm
shoeper commentedon Feb 16, 2015
Try to increase
fastcgi_read_timeoutin your nginx conf. 504 is afaik no php but a gateway timeout. And while moving files to the trash bin ownCloud doesn't send any data that's why you get a 504.See: http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_read_timeout
DeepDiver1975 commentedon Mar 3, 2015
trashbin expiry will be done in a background process starting 8.1 - see #14644
PVince81 commentedon Mar 6, 2015
There are three tasks to address trashbin slowness:
DeepDiver1975 commentedon Mar 16, 2015
should be fixed for 8.1
PVince81 commentedon Mar 16, 2015
"Make trashbin expiration faster for OC < 8.1" (backport) still needs to be reviewed: #14926