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

use stricter mutex policy to prevent installed.json corruption #635

Merged
merged 2 commits into from
Apr 29, 2021

Conversation

umbynos
Copy link
Contributor

@umbynos umbynos commented Apr 27, 2021

Please check if the PR fulfills these requirements

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • Tests for the changes have been added (for bug fixes / features)
  • What kind of change does this PR introduce?

Bug fix, followup of #585

  • What is the current behavior?

Sometimes the agent responds with a 500 error to curl ‘http://127.0.0.1:8991/v2/pkgs/tools/installed’ with this payload {“name”:“fault”,“id”:“JOhq4y8g”,“message”:“invalid character ‘s’ after top-level value”,“temporary”:false,“timeout”:false,“fault”:true}.
This error should be caused by a race condition with the result that installed.json file gets corrupted

  • What is the new behavior?

This PR should fix this behavior by adding a stricter mutex policy and releasing the mutex only after the file has been written

  • Does this PR introduce a breaking change?

no

  • Other information:

@umbynos umbynos self-assigned this Apr 27, 2021
@umbynos umbynos requested a review from cmaglie April 27, 2021 13:07
@umbynos
Copy link
Contributor Author

umbynos commented Apr 28, 2021

To test this change I created 1.2.3-rc1

@umbynos umbynos merged commit 233f04a into main Apr 29, 2021
@umbynos umbynos deleted the umbynos/fix_write_installed.json branch April 29, 2021 10:27
umbynos added a commit that referenced this pull request Apr 29, 2021
* use stricter mutex policy to prevent installed.json corruption

* move locking before installed.json read
@rsora rsora added the type: imperfection Perceived defect in any part of project label Sep 22, 2021
@per1234 per1234 added the topic: code Related to content of the project itself label Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants