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

Fixes #17172: Concurrent access to node info cache cause exception to be thrown when accessing cache content #2910

Conversation

VinceMacBuche
Copy link
Member

@VinceMacBuche VinceMacBuche requested a review from fanf April 21, 2020 14:15
@@ -413,7 +413,10 @@ trait NodeInfoServiceCached extends NodeInfoService with NamedZioLogger with Cac
}
} else {
logPure.debug(s"NodeInfo cache is up to date, ${nodeCache.map(c => s"last modification time: '${c.lastModTime}' for: '${c.lastModEntryCSN.mkString("','")}'").getOrElse("")}") *>
nodeCache.get.nodeInfos.succeed //get is ok because in a synchronized block with a test on isEmpty
(nodeCache match {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you correct the indentation here ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation was not correct, this is a parameter of the first line

logPure.debug (xxxx) *> (nodeCache match ....)

if really find it easier to understand that the second line depends on the first one with one more indent level.

When aligned on the same line it took me some time to understand why it did not compile without parenthesis, because first line is too long to see *> on screen

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*> does not means it's a parameter, it's a sequence (like with ;).
You can put *> at the begining to make it more visible.
You may be force to use parenthesis for the else to make scalac happy.
The parenthesis around nodeCache match {} should not be necessary though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no without parenthesis it considers that

logPure.debug(s"NodeInfo cache is up to date, ${nodeCache.map(c => s"last modification time: '${c.lastModTime}' for: '${c.lastModEntryCSN.mkString("','")}'").getOrElse("")}") *> nodeCache

is the variable to match and not just nodeCache

it does not work to put it before the second line it does not compile (*> cannot be applied )

anyway i'll go back to old indentation

@VinceMacBuche
Copy link
Member Author

Commit modified

@VinceMacBuche VinceMacBuche force-pushed the bug_17172/error_when_updateing_dynamic_group branch from edef48b to d2cce87 Compare April 22, 2020 07:43
@VinceMacBuche
Copy link
Member Author

PR updated with a new commit

@Normation-Quality-Assistant
Copy link
Contributor

This PR is not mergeable to upper versions.
Since it is "Ready for merge" you must merge it by yourself using the following command:
rudder-dev merge https://github.com/Normation/rudder/pull/2910
-- Your faithful QA
Kant merge: "To be is to do."
(https://ci.normation.com/jenkins/job/merge-accepted-pr/23536/console)

@fanf
Copy link
Member

fanf commented Apr 23, 2020

OK, squash merging this PR

@fanf fanf force-pushed the bug_17172/error_when_updateing_dynamic_group branch from 527df7b to 1a43f6d Compare April 23, 2020 15:46
@fanf fanf merged commit 1a43f6d into Normation:branches/rudder/6.0 Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants