summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-07-09 22:31:40 +0200
committerMorris Jobke <hey@morrisjobke.de>2015-07-09 22:31:40 +0200
commit48b1e9e2a6e24fb221e9047e1063082d12dbff87 (patch)
tree48a6e63981e49cee8ff30c91dc8f0bf680673811 /lib
parentf21eb35431cfcd9c64e795119b9635d9c888bf75 (diff)
parent39e391fd1ad87ec034ecaba1ade2de95a53096d7 (diff)
downloadnextcloud-server-48b1e9e2a6e24fb221e9047e1063082d12dbff87.tar.gz
nextcloud-server-48b1e9e2a6e24fb221e9047e1063082d12dbff87.zip
Merge pull request #17288 from owncloud/stable8.1-chunk-cleanupgracefulonlock
Stable8.1 chunk cleanupgracefulonlock
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php10
-rw-r--r--lib/private/cache/file.php13
2 files changed, 18 insertions, 5 deletions
diff --git a/lib/base.php b/lib/base.php
index 829c2bcb866..8812d5698f1 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -730,8 +730,14 @@ class OC {
// NOTE: This will be replaced to use OCP
$userSession = self::$server->getUserSession();
$userSession->listen('\OC\User', 'postLogin', function () {
- $cache = new \OC\Cache\File();
- $cache->gc();
+ try {
+ $cache = new \OC\Cache\File();
+ $cache->gc();
+ } catch (\Exception $e) {
+ // a GC exception should not prevent users from using OC,
+ // so log the exception
+ \OC::$server->getLogger()->warning('Exception when running cache gc: ' . $e->getMessage(), array('app' => 'core'));
+ }
});
}
}
diff --git a/lib/private/cache/file.php b/lib/private/cache/file.php
index 32c00125764..69008c7fab5 100644
--- a/lib/private/cache/file.php
+++ b/lib/private/cache/file.php
@@ -177,9 +177,16 @@ class File implements ICache {
}
while (($file = readdir($dh)) !== false) {
if ($file != '.' and $file != '..') {
- $mtime = $storage->filemtime('/' . $file);
- if ($mtime < $now) {
- $storage->unlink('/' . $file);
+ try {
+ $mtime = $storage->filemtime('/' . $file);
+ if ($mtime < $now) {
+ $storage->unlink('/' . $file);
+ }
+ } catch (\OCP\Lock\LockedException $e) {
+ // ignore locked chunks
+ \OC::$server->getLogger()->debug('Could not cleanup locked chunk "' . $file . '"', array('app' => 'core'));
+ } catch (\OCP\Files\LockNotAcquiredException $e) {
+ \OC::$server->getLogger()->debug('Could not cleanup locked chunk "' . $file . '"', array('app' => 'core'));
}
}
}