-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
ManyConcurrentAddsTakes_ForceContentionWithToArray fails intermittently on osx-arm64 #76501
Comments
Also failed in #75421 (comment) |
I believe the failure is genuine but I was not able to reliably reproduce it on my machine yet. Should we mark the test with |
"Known Build Error" label turns on automation to monitor and collect statistics about the failure. Let's see how often it fails. If it fails too often, we are going to disable it. |
It reproduces in less than a minute when running the single test in loop on M1. |
In fact, it reproduces under regular CoreCLR as well:
ConcurrentDict.cs: // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Diagnostics;
using System.Text;
using System.Collections.Concurrent;
using System.Threading.Tasks;
public class BringUpTest
{
const int Pass = 100;
const int Fail = -1;
public static int Main()
{
for (int i = 0; i < 200; i++)
Test();
return Pass;
}
public static void Test()
{
IProducerConsumerCollection<int> c = new ConcurrentQueue<int>();
const int MaxCount = 4;
DateTime end = DateTime.UtcNow + TimeSpan.FromSeconds(1);
Task addsTakes = Task.Factory.StartNew(() =>
{
while (DateTime.UtcNow < end)
{
for (int i = 1; i <= MaxCount; i++)
{
Assert.True(c.TryAdd(i));
}
for (int i = 1; i <= MaxCount; i++)
{
int item;
Assert.True(c.TryTake(out item));
Assert.InRange(item, 1, MaxCount);
}
}
});
while (DateTime.UtcNow < end)
{
int[] arr = c.ToArray();
Assert.InRange(arr.Length, 0, MaxCount);
Assert.DoesNotContain(0, arr); // make sure we didn't get default(T)
}
addsTakes.GetAwaiter().GetResult();
Assert.Equal(0, c.Count);
}
}
class Assert
{
public static void Equal(int expected, int actual)
{
if (expected != actual)
{
Console.WriteLine($"{actual} != {expected}");
throw new Exception();
}
}
public static void True(bool actual)
{
if (!actual)
{
Console.WriteLine($"!{actual}");
throw new Exception();
}
}
public static void InRange(int actual, int min, int max)
{
if (actual < min || actual > max)
{
Console.WriteLine($"{actual} not in {min}-{max}");
throw new Exception();
}
}
public static void DoesNotContain(int value, int[] array)
{
if (Array.Exists(array, e => e == value))
{
Console.WriteLine($"FAIL");
throw new Exception();
}
}
} |
Tagging subscribers to this area: @dotnet/area-system-collections Issue Details
{
"ErrorMessage" : "System.Collections.Concurrent.Tests.ProducerConsumerCollectionTests.ManyConcurrentAddsTakes_ForceContentionWithToArray",
"BuildRetry": false
} Failed in #76499. Log: https://helixre107v0xdeko0k025g8.blob.core.windows.net/dotnet-runtime-refs-pull-76499-merge-3c4c964d671349bdbd/System.Collections.Concurrent.Tests/1/console.b1cceddc.log?helixlogtype=result ReportSummary
|
Note that the failure is also reproducible on 7.0 RC1 so it may be appropriate to change the milestone. |
Might be related: #76141 |
Likely not, I already checked the existing issues. This one is |
Looks like an ordering issue on arm64. I will take a look |
I am able to reproduce this on OSX-arm64-CoreCLR |
PR with a fix: #78142 I am running the repro in multiple processes for about 20 min now with no failures. It typically fails in under one minute. |
Failed in #76499. Log: https://helixre107v0xdeko0k025g8.blob.core.windows.net/dotnet-runtime-refs-pull-76499-merge-3c4c964d671349bdbd/System.Collections.Concurrent.Tests/1/console.b1cceddc.log?helixlogtype=result
Report
Summary
The text was updated successfully, but these errors were encountered: