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
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
@@ -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;
24 changes: 24 additions & 0 deletions Tests/Tests.BugFinding/Synchronization/AutoResetEventTests.cs
Original file line number Diff line number Diff line change
@@ -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()
{
2 changes: 1 addition & 1 deletion Tests/compare-rewriting-diff-logs.ps1
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ $targets = [ordered]@{
$expected_hashes = [ordered]@{
"rewriting" = "4CDA15D6A718DA0290489A50906F1B2364E9B4562F72D48A59284299B783C5BF"
"rewriting-helpers" = "676906904C5AB80B10069113CA70F5D5EA26A0C2BFB8D6B4EAE46E602BF1AEAE"
"testing" = "0112C27DC0C301BA980E598C484CFABA4F881F5E91FDD74107ADE0002A6901A4"
"testing" = "786F4C49E4C7361F9D91BA0DC61E05F33E3E04BB284ACF204BB9DBD73498AFEB"
"actors" = "492A23570BEDA4A9DF0D55DBCD7DB7B5D43A7FA1E9906BFF0CF98E477BBBBF55"
"actors-testing" = "C9E531EC9C367CFA9E44DCC1F9524D2D92F026E0744CC7C65FE016B621E5B659"
}

Unchanged files with check annotations Beta

/// Initializes a new instance of the <see cref="RuntimeException"/> class.
/// </summary>
protected RuntimeException(SerializationInfo serializationInfo, StreamingContext streamingContext)
: base(serializationInfo, streamingContext)

Check warning on line 44 in Source/Core/Runtime/Exceptions/RuntimeException.cs

GitHub Actions / Build and test Coyote (windows-latest)

'Exception.Exception(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)

Check warning on line 44 in Source/Core/Runtime/Exceptions/RuntimeException.cs

GitHub Actions / Build and test Coyote (ubuntu-latest)

'Exception.Exception(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)

Check warning on line 44 in Source/Core/Runtime/Exceptions/RuntimeException.cs

GitHub Actions / Build and test Coyote (macos-latest)

'Exception.Exception(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)
{
}
}
SerializationInfo info, StreamingContext context)
{
(instance as Wrapper)?.CheckDataRace(true);
instance.GetObjectData(info, context);

Check warning on line 253 in Source/Test/Rewriting/Types/Collections/Generic/Dictionary.cs

GitHub Actions / Build and test Coyote (windows-latest)

'Dictionary<TKey, TValue>.GetObjectData(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)

Check warning on line 253 in Source/Test/Rewriting/Types/Collections/Generic/Dictionary.cs

GitHub Actions / Build and test Coyote (ubuntu-latest)

'Dictionary<TKey, TValue>.GetObjectData(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)

Check warning on line 253 in Source/Test/Rewriting/Types/Collections/Generic/Dictionary.cs

GitHub Actions / Build and test Coyote (macos-latest)

'Dictionary<TKey, TValue>.GetObjectData(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)
}
/// <summary>
StreamingContext context)
{
(instance as Wrapper)?.CheckDataRace(false);
instance.GetObjectData(info, context);

Check warning on line 190 in Source/Test/Rewriting/Types/Collections/Generic/HashSet.cs

GitHub Actions / Build and test Coyote (windows-latest)

'HashSet<T>.GetObjectData(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)

Check warning on line 190 in Source/Test/Rewriting/Types/Collections/Generic/HashSet.cs

GitHub Actions / Build and test Coyote (ubuntu-latest)

'HashSet<T>.GetObjectData(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)

Check warning on line 190 in Source/Test/Rewriting/Types/Collections/Generic/HashSet.cs

GitHub Actions / Build and test Coyote (macos-latest)

'HashSet<T>.GetObjectData(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)
}
/// <summary>
/// Initializes a new instance of the <see cref="Wrapper"/> class.
/// </summary>
internal Wrapper(SerializationInfo info, StreamingContext context)
: base(info, context) => this.Setup();

Check warning on line 380 in Source/Test/Rewriting/Types/Collections/Generic/HashSet.cs

GitHub Actions / Build and test Coyote (windows-latest)

'HashSet<T>.HashSet(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)

Check warning on line 380 in Source/Test/Rewriting/Types/Collections/Generic/HashSet.cs

GitHub Actions / Build and test Coyote (ubuntu-latest)

'HashSet<T>.HashSet(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)

Check warning on line 380 in Source/Test/Rewriting/Types/Collections/Generic/HashSet.cs

GitHub Actions / Build and test Coyote (macos-latest)

'HashSet<T>.HashSet(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)
#if NET || NETCOREAPP3_1
/// <summary>
namespace Microsoft.Coyote.Rewriting.Types.Runtime.CompilerServices
{
/// <summary>
/// Provides an awaitable object that is the outcome of invoking <see cref="SystemTask.ConfigureAwait"/>.

Check warning on line 14 in Source/Test/Rewriting/Types/Runtime/CompilerServices/ConfiguredTaskAwaitable.cs

GitHub Actions / Build and test Coyote (windows-latest)

Ambiguous reference in cref attribute: 'SystemTask.ConfigureAwait'. Assuming 'Task.ConfigureAwait(bool)', but could have also matched other overloads including 'Task.ConfigureAwait(ConfigureAwaitOptions)'.

Check warning on line 14 in Source/Test/Rewriting/Types/Runtime/CompilerServices/ConfiguredTaskAwaitable.cs

GitHub Actions / Build and test Coyote (ubuntu-latest)

Ambiguous reference in cref attribute: 'SystemTask.ConfigureAwait'. Assuming 'Task.ConfigureAwait(bool)', but could have also matched other overloads including 'Task.ConfigureAwait(ConfigureAwaitOptions)'.

Check warning on line 14 in Source/Test/Rewriting/Types/Runtime/CompilerServices/ConfiguredTaskAwaitable.cs

GitHub Actions / Build and test Coyote (macos-latest)

Ambiguous reference in cref attribute: 'SystemTask.ConfigureAwait'. Assuming 'Task.ConfigureAwait(bool)', but could have also matched other overloads including 'Task.ConfigureAwait(ConfigureAwaitOptions)'.
/// </summary>
/// <remarks>This type is intended for compiler use only.</remarks>
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]