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

Minor fixes to the cache: Deadlock and Perl structure #1353

Merged
merged 2 commits into from
May 30, 2017

Conversation

foursixnine
Copy link
Member

This PR fixes poo#19270 and poo#19278

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
Copy link

codecov bot commented May 30, 2017

Codecov Report

Merging #1353 into master will decrease coverage by 0.03%.
The diff coverage is 0%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
lib/OpenQA/Worker/Cache.pm 76.27% <0%> (-1.08%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 49e14ec...9fe8adc. Read the comment docs.

} # purge asset will die anyway in case of failure.
last if ($cache_real_size < $limit);
if ($result) {
foreach my $asset ($result) {
Copy link
Contributor

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 || ())

@coolo coolo merged commit e5ded23 into os-autoinst:master May 30, 2017
@@ -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";
Copy link
Member

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 $@";
Copy link
Member

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 $@";
Copy link
Member

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 $@";
Copy link
Member

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!";
Copy link
Member

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?

coolo pushed a commit that referenced this pull request May 30, 2017
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants