fix: Deadlock during cost calculation#173
Merged
swithek merged 8 commits intojellydator:v3from Jun 5, 2025
Merged
Conversation
Pull Request Test Coverage Report for Build 15467277810Details
💛 - Coveralls |
Contributor
Author
|
@swithek: Would you please review? |
3 tasks
Contributor
|
@dadrus thanks for the PR. I'll try to review it by the end of this week. |
davseby
reviewed
May 25, 2025
swithek
requested changes
Jun 4, 2025
Contributor
swithek
left a comment
There was a problem hiding this comment.
Looks good, one small change is needed. Also, you might need to merge/rebase your branch on the latest v3 branch, because there have been some changes there that might affect some of your code (at least the tests).
davseby
approved these changes
Jun 5, 2025
swithek
approved these changes
Jun 5, 2025
Contributor
|
Thanks for the change @dadrus Quality work as always 👍 |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unfortunately, the implementation, I've done in #152 can cause a deadlock during cost calculation:
The
updatemethod of theItemlocks an RW lock and calls theitem.calculateCost(item), which if configured, may make use of the available getter functions of the item object. All these functions make however use of the R lock - thus we have a deadlock.This PR updates the implementation of the
Itemand performs the calculation of the item cost on a snapshot rather the actual update.The test has been updated as well to use a public method. Without the update to the Item implementation the corresponding test will run into a deadlock