Skip to content

Conversation

@graalvmbot
Copy link
Collaborator

When assignableFilterTypeFlow and FieldFilterTypeFlow saturate, they replace themselves with all instantiated typeflow of theirdeclaredType. The current ordering of operations allows for an interleaving, in which a new predicated flow f may be added to already saturated filter flow, which will result in f never getting enabled.

An example of a problematic execution

Thread t1 yields inside FilterTypeFlow.addPredicatedline 112 before calling super. FilterTypeFlow.onInputSaturated gets executed on another thread t2, which will lead to calling swapOut, replacing this flow with the filterType. t2 yields after swapping all dependencies, but before marking predicate edge as triggered. t1 continues, adds a new predicate to the previously cleared set, but since predicate edge was not marked as triggered yet, it won't enable the new flow f. t2 continues, marks the predicate edge as triggered, but won't do anything with f, which was added to its set of predicated flows in the meantime. As a result, a saturated flow with triggered predicate edge will end up having a new predicated flow (which is stil disabled), but predicate edge will not trigger again.

Solution

We change the order of swapping out predicate edges and marking predicate edge as triggered, making sure that any new concurrently added predicated flows will get enabled during the super.addPredicated call.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Apr 1, 2025
@graalvmbot graalvmbot closed this Apr 1, 2025
@graalvmbot graalvmbot merged commit a6b0689 into master Apr 1, 2025
3 of 13 checks passed
@graalvmbot graalvmbot deleted the d-kozak/GR-63549/concurency-fixes branch April 1, 2025 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants