Skip to content
Snippets Groups Projects
Commit 4160ac71 authored by Mark Harrison's avatar Mark Harrison
Browse files

Don't store blank data if we fail to get anything from the shared state file

Occasionally on some systems, the data returned from the shared state file is
bad/blank, despite locking. Ideally we'd find the cause of this and fix it,
but various attempts haven't identified exactly why this happens (including
running fsync after writing and before unlocking). If the data returned is
blank, we should use the latest available data rather than returning blank
data to the user/monitoring system.
parent 9c8947ca
No related branches found
No related tags found
No related merge requests found
......@@ -42,9 +42,11 @@ sub get_shared_state {
$blob = <$fh>;
}
flock($fh, LOCK_UN); # Release the lock
eval $blob;
die $@ if ($@);
$self->{store} = $VAR1;
if (defined $blob) {
eval $blob;
die $@ if ($@);
$self->{store} = $VAR1;
}
} else {
die "Unable to read shared state";
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment