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

fix PcpMmvWriter race condition #133

Merged
merged 4 commits into from
Nov 22, 2024

Conversation

pwinckles
Copy link
Contributor

Fixes a race condition where metric updates can be lost if the happen while PcpMmvWriter is being reset. Previously, updates were dropped if the writer was not in a started state. If this happened while the the writer was executing start(), then it's possible the updated value would be lost if the old metric value had already been written.

The issue is addressed here by blocking the metric update when the writer is in a STARTING state, until the writer has been fully started. If the writer is in a STARTED state, the update is applied immediately. If the writer is in a STOPPED state, the update is dropped immediately.

Resolves #132

Fixes a race condition where metric updates can be lost if the happen
while `PcpMmvWriter` is being reset. Previously, updates were dropped
if the writer was not in a started state. If this happened while the
the writer was executing `start()`, then it's possible the updated
value would be lost if the old metric value had already been written.

The issue is addressed here by blocking the metric update when the
writer is in a `STARTING` state, until the writer has been fully
started. If the writer is in a `STARTED` state, the update is applied
immediately. If the writer is in a `STOPPED` state, the update is
dropped immediately.

Resolves performancecopilot#132
If the old code threw an exception starting, it would remaing in a
stopped state. This replicates that behavior. If the start process
fails, it reverts back to `STOPPED` and does not remain in a
`STARTING` state.
Adds the config property `parfait.writer.wait` that can be used to
adjust the amount of time an update metric operation will wait for the
writer to start.
@pwinckles pwinckles merged commit 49dec4b into performancecopilot:main Nov 22, 2024
1 check passed
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.

Race condition causes metric updates to be lost
2 participants