Repository navigation
Fix lost parameter thread-count increments on first insertion - #3653
Open
hutiefang76 wants to merge 1 commit into
Open
hutiefang76 wants to merge 1 commit into
hutiefang76 wants to merge 1 commit into
Conversation
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.
Describe what this PR does / why we need it
Prevent
ParameterMetric.addThreadCountfrom losing an increment when two callers first encounter the same parameter. Previously the first caller published a zero counter, another caller incremented it, and the first caller replaced the entry with a different counter initialized to one.Does this pull request fix one issue?
Related to #1462 and #3058. This fixes the first-insertion increment race only, and deliberately does not close either broader issue.
Describe how you did it
Publish the counter initialized to one with a single
putIfAbsent. Increment the existing counter when another caller already published it. Apply the same change to scalar, array and collection arguments.Describe how to verify it
verify:ParameterMetricTest,ParamFlowCheckerTest,ParamFlowDefaultCheckerTest,ParamFlowPartialIntegrationTest,ParamFlowSlotTest,ParameterMetricStorageTest— 22 tests passed.ParameterMetricTest— 5 tests passed.putIfAbsentreturns. Each asserts a count of two, a single cache entry and subsequent decrement cleanup. No sleeps or probabilistic stress loops.Special notes for reviews
This does not address the concurrent decrement/removal race described in #3058 or change cache eviction policy. It is a focused part of the counter-map concurrency concerns in #1462.
AI assistance: DeepSeek and Codex assisted implementation, tests and this description.