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 race condition in time barriers #49

Merged
merged 7 commits into from
May 24, 2023
Merged

Fix race condition in time barriers #49

merged 7 commits into from
May 24, 2023

Conversation

cmnrd
Copy link
Contributor

@cmnrd cmnrd commented May 23, 2023

There was a race condition in the main synchronization primitive that we use to coordinate enclaves. Our code used two separate locks, one for protecting the variable holding the last released tag and another one for receiving updates from the scheduler. However, we can only use one of the locks when calling wait on our condition variable. This creates a race between updating the wait condition (i.e. releasing a tag) and actually starting the wait under the second lock (Here is an explanation, see "An atomic predicate") This PR refactors the time barriers, such that the global scheduler lock is also used to protect our local released_tag_ variable.

This adresses lf-lang/lingua-franca#1746

@cmnrd cmnrd added the bugfix label May 23, 2023
@cmnrd cmnrd requested review from tanneberger and cs-99 May 23, 2023 09:35
Copy link
Collaborator

@tanneberger tanneberger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't find any surface level flaws. I guess u just moved the functionality from the conditional variable that does the locking to the scheduler.

cmnrd added 2 commits May 24, 2023 12:53
the negation operator got lost in an earlier commit
cmnrd added a commit to lf-lang/lingua-franca that referenced this pull request May 24, 2023
cmnrd added a commit to lf-lang/lingua-franca that referenced this pull request May 24, 2023
Copy link
Collaborator

@tanneberger tanneberger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Iooks good

cmnrd added a commit to lf-lang/lingua-franca that referenced this pull request May 24, 2023
@cmnrd cmnrd merged commit b607f1f into master May 24, 2023
6 of 8 checks passed
@cmnrd cmnrd deleted the enclave-fix branch May 24, 2023 15:06
cmnrd added a commit to lf-lang/lingua-franca that referenced this pull request May 24, 2023
cmnrd added a commit to lf-lang/lingua-franca that referenced this pull request May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants