-
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
ProcessTests.LongProcessNamesAreSupported test failure #111460
Comments
Assigned to @adamsitnik for triage |
Sees "123456789012345" for process started as "123456789012345678901234567890". The failures are apparently all Linux on 32bit arm |
Either it can't find /proc/(pid)/comm or that contains the truncated value for some reason or it's not passing the file correctly. |
It affects all Linux architectures as far as I can tell. For example, https://helixr1107v0xdcypoyl9e7f.blob.core.windows.net/dotnet-runtime-refs-heads-main-019d0ba545ab465c98/System.Diagnostics.Process.Tests/1/console.f5719d04.log?helixlogtype=result shows this failure on alpine-3.21-helix-amd64 |
Note that this is intermittent failure. We run this tests thousands of times per week, but it was only hit in 5 runs. My guess is that something is changing the process name during the process lifetime. When we read the process name too soon or too late, we see the truncated process name. |
I see it more often in native AOT runs. Build analysis unfortunately doesn't track runtime-nativeaot-outerloop pipeline so it's not part of the report above. But for example the outerloop run in https://github.com/dotnet/runtime/pull/111713/checks?check_run_id=36020981722 just hit this on both linux-arm and linux-arm64 legs within a single pipeline run. |
It suggests that we see the wrong process name when we read it too soon. (Native AOT is typically a lot faster for code that is executed once or just a few times). |
Triage: it seems that reading a process name on Linux makes some of our tests flaky (#109630, #110643, #111460). I am going to try to add a simple retry mechanism to see if it helps to verify #111460 (comment) hypothesis. |
I have built a small stress test for the long process names: using System.Diagnostics;
const string LongProcessName = "123456789012345678901234567890";
const string LongProcessPath = "./" + LongProcessName;
const UnixFileMode ExecutablePermissions = UnixFileMode.UserRead | UnixFileMode.UserExecute | UnixFileMode.UserWrite |
UnixFileMode.GroupRead | UnixFileMode.GroupExecute |
UnixFileMode.OtherRead | UnixFileMode.OtherExecute;
File.WriteAllText(LongProcessPath, $"#!/bin/sh\nsleep 1\n"); // sleep 10 min.
File.SetUnixFileMode(LongProcessPath, ExecutablePermissions);
for (int i = 0; i < 3; i++)
new Thread(Work).Start();
for (;;)
{
foreach (var p in Process.GetProcesses())
{
string name = p.ProcessName;
if (name.StartsWith("123") && (name != LongProcessName))
Console.WriteLine($"{DateTime.Now:o} {p.Id} {name}");
}
}
void Work()
{
for (;;)
{
using (Process px = Process.Start(LongProcessPath, "600"))
{
Console.WriteLine($"{DateTime.Now:o} {px.Id} Started");
px.WaitForExit();
Console.WriteLine($"{DateTime.Now:o} {px.Id} Exited");
}
}
} This stress test shows that this Process.Name API is very flaky for long process names during process startup and shutdown. Here are some snippets of output: Short process name is read shortly after process startup:
Short process name is read around process shutdown:
|
Reenable long Process.Name test on OSX Fixes dotnet#111460 Fixes dotnet#29330
Reenable long Process.Name test on OSX Fixes dotnet#111460 Fixes dotnet#29330
Build Information
Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=917938
Build error leg or test failing: System.Diagnostics.Tests.ProcessTests.LongProcessNamesAreSupported
Pull request: #111446
Error Message
Fill the error message using step by step known issues guidance.
Known issue validation
Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=917938
Error message validated:
[System.Diagnostics.Tests.ProcessTests.LongProcessNamesAreSupported [FAIL] Assert.Contains() Failure: Filter not matched in collection
]Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 1/15/2025 5:36:13 PM UTC
Report
Summary
The text was updated successfully, but these errors were encountered: