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

Run cleanup of old upload parts in background job #8759

Closed
MorrisJobke opened this issue Mar 9, 2018 · 7 comments
Closed

Run cleanup of old upload parts in background job #8759

MorrisJobke opened this issue Mar 9, 2018 · 7 comments
Labels
1. to develop Accepted and waiting to be taken care of enhancement medium technical debt
Milestone

Comments

@MorrisJobke
Copy link
Member

Currently the cleanup of the upload folder is run as a login hook:

server/lib/base.php

Lines 808 to 834 in 20f1f75

$userSession->listen('\OC\User', 'postLogin', function () use ($userSession) {
if (!defined('PHPUNIT_RUN')) {
// reset brute force delay for this IP address and username
$uid = \OC::$server->getUserSession()->getUser()->getUID();
$request = \OC::$server->getRequest();
$throttler = \OC::$server->getBruteForceThrottler();
$throttler->resetDelay($request->getRemoteAddress(), 'login', ['user' => $uid]);
}
try {
$cache = new \OC\Cache\File();
$cache->gc();
} catch (\OC\ServerNotAvailableException $e) {
// not a GC exception, pass it on
throw $e;
} catch (\OC\ForbiddenException $e) {
// filesystem blocked for this request, ignore
} catch (\Exception $e) {
// a GC exception should not prevent users from using OC,
// so log the exception
\OC::$server->getLogger()->logException($e, [
'message' => 'Exception when running cache gc.',
'level' => \OCP\Util::WARN,
'app' => 'core',
]);
}
});

We should do this as a background job.

@icewind1991 @rullzer @nickvergessen Opinions?

Should issues like #8753

@rullzer
Copy link
Member

rullzer commented Mar 9, 2018

Yes we should!

@MorrisJobke
Copy link
Member Author

The problem with this is that it is required to be on login to have a valid user session as it sets up the view.

@icewind1991 Is there a way to set this up without the current session? Could you point me at some code that does this so I can come up with a first draft of the fix. Would love to have this fixed in 14 finally.

@Santobert
Copy link

Santobert commented Oct 23, 2018

I noticed a user with more than 20 GB used disk space and a quota of 5 GB. The folder username/uploads needs about 15-20 GB. The command [...] occ files:cleanup doesn't change anything.

After I have deleted most of his files (he knows about it ;) ), his personal files take about 40 MB. The upload folder is shrunk to 15 GB.

Does this situation have anything to do with this ticket? How can I clean up the upload folder?

@MorrisJobke
Copy link
Member Author

Does this situation have anything to do with this ticket? How can I clean up the upload folder?

The user should logout and login again. Then a cleanup is triggered.

@MorrisJobke
Copy link
Member Author

Most of this is addressed in #12227

@MorrisJobke
Copy link
Member Author

Most of this is addressed in #12227

Let's close it as it is now.

@MorrisJobke MorrisJobke removed their assignment Feb 25, 2019
@krakazyabra
Copy link

Hello. Are there any news about this issue? I'm using S3 and, seems, unfinished uploads persist even after logout/login.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of enhancement medium technical debt
Projects
None yet
Development

No branches or pull requests

5 participants