-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Automation - Lock reads and writes from and to the ConfigDigest #14313
Conversation
5f0c659
to
8297979
Compare
core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/autotelemetry21/custom_telemetry.go
Outdated
Show resolved
Hide resolved
core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/autotelemetry21/custom_telemetry.go
Show resolved
Hide resolved
…metry21/custom_telemetry.go Co-authored-by: Jordan Krage <jmank88@gmail.com>
if configChanged { | ||
e.sendNodeVersionMsg() | ||
} |
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.
why change this behaviour of only sending this message on config change and not on regular intervals?
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.
In the previous version of the code, we only sent the message when the config had changed:
chainlink/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/autotelemetry21/custom_telemetry.go
Line 71 in 1a2b7b6
e.sendNodeVersionMsg() |
We need to lock the mutex before checking if the config has changed (the if statement); but because the sendNodeVersionMsg
itself locks the Read lock on the mutex (because it gets called from other places, too), we can't execute the sendNodeVersionMsg
function while the lock is held. And so, we're having to introduce this additional boolean that gets set to true when the config changes (previously, this is when we would have called sendNodeVersionMsg
), and then reference that boolean outside the lock to determine if we should call sendNodeVersionMsg
.
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.
ah sorry had missed that e.sendNodeVersionMsg()
was within the if statement before. There's a separate ticker which sends this message on regular intervals. Thanks for clarifying!
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.
have a question about change of behaviour
Quality Gate passedIssues Measures |
This data race was flagged up in #topic-data-races
The change here is adding a
RWMutex
to synchronize reads and writes from/to the ConfigDigest