-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Test failure: JIT\\Methodical\\tailcall_v4\\hijacking\\hijacking.cmd #40916
Comments
Failed in #41033 (regular CI run):
|
Failure is a timeout after 10 minutes. Looking at recent history for this configuration (x64 R24 NoTC) runs take from 90s - 600s (+); the only other configuration I see with failures is (x64 NoTC). Arm64 completes these in 30s or so. |
C# of this test is: using System;
using System.Threading;
internal struct ForceHelper
{
public unsafe ForceHelper* me1;
public unsafe ForceHelper* me2;
public long counter;
}
internal class Repro
{
private volatile bool stop;
private bool failed;
private long counts;
private long gc;
private unsafe void TailHelper1(ForceHelper h)
{
++h.counter;
if (this.stop)
{
Interlocked.Add(ref this.counts, h.counter);
}
else
{
if (&h != h.me1)
{
if (h.counter > 3L)
{
this.failed = true;
this.stop = true;
Interlocked.Add(ref this.counts, h.counter);
return;
}
h.me1 = &h;
}
/* tail. */ this.TailHelper2(h, h);
}
}
private unsafe void TailHelper2(ForceHelper h, ForceHelper h2)
{
++h.counter;
if (this.stop)
{
Interlocked.Add(ref this.counts, h.counter);
}
else
{
if (&h != h.me2)
{
if (h.counter > 3L)
{
this.failed = true;
this.stop = true;
Interlocked.Add(ref this.counts, h.counter);
return;
}
h.me2 = &h;
}
/* tail. */ this.TailHelper1(h);
}
}
private void TailCallThread()
{
/* tail. */ this.TailHelper1(new ForceHelper());
}
private void Collector()
{
while (!this.stop)
{
GC.Collect();
++this.gc;
}
}
private static int Main()
{
Repro repro = new Repro();
Thread[] threadArray = new Thread[2]
{
new Thread(new ThreadStart(repro.Collector)),
new Thread(new ThreadStart(repro.TailCallThread))
};
foreach (Thread thread in threadArray)
thread.Start();
for (int index = 0; index < 30; ++index)
{
Thread.Sleep(1000);
if (repro.stop)
break;
}
repro.stop = true;
foreach (Thread thread in threadArray)
thread.Join();
Console.WriteLine("Executed {0} GCs", (object) repro.gc);
if (repro.failed)
{
Console.WriteLine("Executed {0} tail calls before failing", (object) repro.counts);
return 101;
}
Console.WriteLine("Executed {0} tail calls", (object) repro.counts);
Console.WriteLine("PASS");
return 100;
}
} So it has two threads using full cores, one doing tailcalls and one calling |
A loop like this can pretty much prevent all other threads in the process from running if there are other things running on the machine like it is the case in the test run setup. Something like:
It can be taking minutes just to get through the initial test setup phase. Maybe the GC.Collect loop should have Thread.Sleep(1) in it? |
It looks like the most recent relevant change was by myself: fdaf97e#diff-ad29682edcb1c578b9d43b941c66b861 There I noticed that the test was not using helpers on x64, and I changed it to use helpers (the old unwind-based helpers). It looks like I ran into timeouts after this because I also reduced the intensity of the test a lot (but not touching the
Thanks for the explanation, it makes perfect sense -- if there are few available threads then the GC thread has to be preempted between two GCs, which is pretty unlikely. The fix sounds fine to me but I do wonder how it affects the effectivity of this regression test (in any case, the fix seems necessary). |
Calling GC.Collect in a tight loop is unnecessary for the test and causing timeouts in CI. Fixes dotnet#40916
Calling GC.Collect in a tight loop is unnecessary for the test and causing timeouts in CI. Fixes #40916
Calling GC.Collect in a tight loop is unnecessary for the test and causing timeouts in CI. Fixes #40916
Calling GC.Collect in a tight loop is unnecessary for the test and causing timeouts in CI. Fixes #40916 Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
failed in job: runtime-coreclr outerloop 20200816.2
Error message
The text was updated successfully, but these errors were encountered: