-
Notifications
You must be signed in to change notification settings - Fork 205
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
Minor fixes to the cache: Deadlock and Perl structure #1353
Conversation
To avoid the worker locking itself, the die instruction had to go away. The problem lies in the try_lock_asset, since most workers will wait here and timers start at the same time, there will be a race condition at the point where said function it's called. It could happen also with update_asset method, but it's most unlikely... But if it fails at this point, there's nothing much we can do other than let the job be restarted by the webui
Codecov Report
@@ Coverage Diff @@
## master #1353 +/- ##
==========================================
- Coverage 87.32% 87.29% -0.04%
==========================================
Files 101 101
Lines 7450 7453 +3
==========================================
Hits 6506 6506
- Misses 944 947 +3
Continue to review full report at Codecov.
|
} # purge asset will die anyway in case of failure. | ||
last if ($cache_real_size < $limit); | ||
if ($result) { | ||
foreach my $asset ($result) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to avoid the extra indentation level you can use
for my $asset ($result || ())
@@ -135,7 +135,7 @@ sub download_asset { | |||
$asset = $code; | |||
} | |||
else { | |||
print $log "CACHE: Abnormal situation, bailing out but still retying\n"; | |||
print $log "CACHE: Abnormal situation, retry to download\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make this line different from the previous one.
@@ -251,8 +251,8 @@ sub try_lock_asset { | |||
}; | |||
|
|||
if ($@) { | |||
log_error "Rolling back $@"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you also make this different from L215?
@@ -271,8 +271,8 @@ sub add_asset { | |||
eval { $dbh->prepare($sql)->execute($asset) or die $dbh->errstr; }; | |||
|
|||
if ($@) { | |||
log_error "Rolling back $@"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and this :-)
@@ -318,8 +318,8 @@ sub purge_asset { | |||
}; | |||
|
|||
if ($@) { | |||
log_error "Rolling back $@"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow, so often? please make it also a unique message
} | ||
} | ||
else { | ||
log_error "There are not more elements to remove!"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/not more/no more/ ? and isn't this log_warn?
commit e5ded23 Merge: d9d39c5 9fe8adc Author: Stephan Kulow <coolo@kde.org> AuthorDate: Tue May 30 20:58:19 2017 +0200 Commit: GitHub <noreply@github.com> CommitDate: Tue May 30 20:58:19 2017 +0200 Merge pull request #1353 from foursixnine/fix/cache_deadlocks Minor fixes to the cache: Deadlock and Perl structure
This PR fixes poo#19270 and poo#19278