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

reschedule before AutoResetEvent.Reset #496

Merged
merged 4 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Source/Test/Rewriting/Types/Threading/EventWaitHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ internal bool Reset(CoyoteRuntime runtime)
{
runtime.NotifyUncontrolledSynchronizationInvocation("EventWaitHandle.Reset");
}
else if (runtime.Configuration.IsLockAccessRaceCheckingEnabled)
{
runtime.ScheduleNextOperation(current, SchedulingPointType.Interleave);
}

this.IsSignaled = false;
return true;
Expand Down
24 changes: 24 additions & 0 deletions Tests/Tests.BugFinding/Synchronization/AutoResetEventTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,30 @@ public void TestWaitDeadlock()
replay: true);
}

[Fact(Timeout = 5000)]
public void TestResetDeadlock()
{
this.TestWithError(() =>
{
var threadReady = new AutoResetEvent(false);
var autoResetEvent1 = new AutoResetEvent(false);
var task = Task.Run(() =>
{
threadReady.WaitOne();
autoResetEvent1.Set();
});

threadReady.Set();
autoResetEvent1.Reset();
autoResetEvent1.WaitOne();
},
errorChecker: (e) =>
{
Assert.StartsWith("Deadlock detected.", e);
},
configuration: this.GetConfiguration().WithLockAccessRaceCheckingEnabled().WithTestingIterations(20));
}

[Fact(Timeout = 5000)]
public void TestWaitWithAllIndexesSet()
{
Expand Down
2 changes: 1 addition & 1 deletion Tests/compare-rewriting-diff-logs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $targets = [ordered]@{
$expected_hashes = [ordered]@{
"rewriting" = "4CDA15D6A718DA0290489A50906F1B2364E9B4562F72D48A59284299B783C5BF"
"rewriting-helpers" = "676906904C5AB80B10069113CA70F5D5EA26A0C2BFB8D6B4EAE46E602BF1AEAE"
"testing" = "0112C27DC0C301BA980E598C484CFABA4F881F5E91FDD74107ADE0002A6901A4"
"testing" = "786F4C49E4C7361F9D91BA0DC61E05F33E3E04BB284ACF204BB9DBD73498AFEB"
"actors" = "492A23570BEDA4A9DF0D55DBCD7DB7B5D43A7FA1E9906BFF0CF98E477BBBBF55"
"actors-testing" = "C9E531EC9C367CFA9E44DCC1F9524D2D92F026E0744CC7C65FE016B621E5B659"
}
Expand Down
Loading