You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Test Failed: GetGCMemoryInfo returns negative value on ARM32 #13115
changed the title [-]Microsoft.DotNet.RemoteExecutor.RemoteExecutionException : Remote process failed with an unhandled exception.[/-][+]GetGCMemoryInfo returns negative value on ARM32[/+]on Jul 23, 2019
changed the title [-]GetGCMemoryInfo returns negative value on ARM32[/-][+]Test Failed: GetGCMemoryInfo returns negative value on ARM32[/+]on Aug 22, 2019
I didn't. I was told this is a low priority bug, after all, it only repros on Linux ARM32.
Earlier I fixed a compiler warning related to integer overflow and discovered that the CGroup could return bogus value as PhysicalMemoryLimit and RestrictedPhysicalMemoryLimit. IMHO, that looks like a kernel/docker bug. In particular, the values read from the files are larger than size_t::max(), which is simply impossible.
The original code ignored the compiler warning, so the value probably got wrapped and passed the test. My new value clipped it to size_t::max(), which is probably the best I could have done the preserve the meaning [basically I am saying the PhysicalMemoryLimit and RestrictedPhysicalMemoryLimit is as much as the system could have].
I doubt somewhere the number got marshaled to managed code as a signed integer. If we know where that spot is, we can try to do the same clipping there. Of course, the bug could be completely unrelated, this is just my suspicion.
Oh, never mind. I'm sorry for the confusion. For some reason I thought that the change was merged in June instead of July. So it is not high priority but I would like have it fixed relatively soon (in a few weeks) in order to avoid accumulating test bugs.
Today I attempted to repro this bug, and I am unable to, here is my exact setup.
These commands are all ran on a Ubuntu 16.04 LTS physical machine.
I build CoreCLR for Linux ARM from source:
This is the commit I was on:
4519204c19833104451003886b23c39218a48a23
This is the command I used to build CoreCLR:
docker run --rm -v /home/andrewau/git/coreclr:/coreclr -w /coreclr -e ROOTFS_DIR=/crossrootfs/arm mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-cross-14.04-23cacb0-20190528233931 ./build.sh arm cross
After the CoreCLR is built, I need to prepare the managed code to repro, to do that, I installed dotnet core preview 8, here is my dotnet --info output:
.NET Core SDK (reflecting any global.json):
Version: 3.0.100-preview8-013656
Commit: 8bf06ffc8d
Runtime Environment:
OS Name: ubuntu
OS Version: 16.04
OS Platform: Linux
RID: ubuntu.16.04-x64
Base Path: /home/andrewau/dotnet/sdk/3.0.100-preview8-013656/
Host (useful for support):
Version: 3.0.0-preview8-28405-07
Commit: d01b2fb7bc
.NET Core SDKs installed:
3.0.100-preview8-013656 [/home/andrewau/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.0.0-preview8.19405.7 [/home/andrewau/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.0.0-preview8-28405-07 [/home/andrewau/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Using dotnet new console, I created a blank console application, replaced the source code with the following:
using System;
namespace repro
{
class Program
{
static void Main(string[] args)
{
GCMemoryInfo memoryInfo1 = GC.GetGCMemoryInfo();
Console.WriteLine(memoryInfo1.HighMemoryLoadThresholdBytes);
Console.WriteLine(memoryInfo1.MemoryLoadBytes);
Console.WriteLine(memoryInfo1.TotalAvailableMemoryBytes);
Console.WriteLine(memoryInfo1.HeapSizeBytes);
Console.WriteLine(memoryInfo1.FragmentedBytes);
}
}
}
Then I published the app using linux-arm as my runtime identifier.
dotnet publish -r linux-arm --self-contained
With that, I replaced all the coreclr binaries with my local build:
Running the copied repro on the PI, here is what I get:
873960652
0
971067392
0
0
None of the numbers are negative.
I suspect there must be something special setup on the Linux arm devices used for the run, it might be running some sort of docker that mess it up.
Update:
Thanks to @hoyosjs, I was able to get docker running on the Raspberry PI, with that, I was able to run the scenario on the same docker image as it is on the CI. I still get exactly the same numbers. Also tried to run the scenario in a hot loop, it never outputs any negative numbers.
It will be very hard to get to the bottom of this issue without a crash dump given that the problem does not reproduce on local machines. We need to make the test generate a dump file when it fails. How do we do it?
It would be very cool if Xunit could be configured to generate a crush dump if an assert fails (maybe based on an attribute that we can set on demand).
It would be very cool if Xunit could be configured to generate a crush dump if an assert fails (maybe based on an attribute that we can set on demand).
However, it is not the GCTests that is being referred to in this issue. Upon careful inspection, this applies to mono only, so I think we are good to close this issue if the test is indeed running and no failure reported.
@ViktorHofer, who initially disabled the test, to confirm that the test is not currently being disabled.
Activity
danmoseley commentedon Jul 22, 2019
#12639
@Maoni0
Maoni0 commentedon Jul 22, 2019
@VSadov would you please take a look?
VSadov commentedon Jul 22, 2019
#12639 was a test issue and should be fixed.
This looks like a new failure. Here the API seems to return a bogus result.
VSadov commentedon Jul 22, 2019
We did not have any changes around this API, except dotnet/coreclr#25724
@cshung can you take a quick look if the change could cause this?
It looks like we get negative memory size on ARM32
[-]Microsoft.DotNet.RemoteExecutor.RemoteExecutionException : Remote process failed with an unhandled exception.[/-][+]GetGCMemoryInfo returns negative value on ARM32[/+]ViktorHofer commentedon Aug 9, 2019
Still happening on corefx: https://dnceng.visualstudio.com/public/_build/results?buildId=302066&view=ms.vss-test-web.build-test-results-tab&runId=8594366&resultId=167836&paneView=debug
Will disable the test again.
[-]GetGCMemoryInfo returns negative value on ARM32[/-][+]Test Failed: GetGCMemoryInfo returns negative value on ARM32[/+]sergiy-k commentedon Aug 23, 2019
@cshung, did you have a chance to look at this failure and check whether it is related to your change?
cshung commentedon Aug 23, 2019
I didn't. I was told this is a low priority bug, after all, it only repros on Linux ARM32.
Earlier I fixed a compiler warning related to integer overflow and discovered that the
CGroupcould return bogus value asPhysicalMemoryLimitandRestrictedPhysicalMemoryLimit. IMHO, that looks like a kernel/docker bug. In particular, the values read from the files are larger thansize_t::max(), which is simply impossible.The original code ignored the compiler warning, so the value probably got wrapped and passed the test. My new value clipped it to
size_t::max(), which is probably the best I could have done the preserve the meaning [basically I am saying the PhysicalMemoryLimit and RestrictedPhysicalMemoryLimit is as much as the system could have].I doubt somewhere the number got marshaled to managed code as a signed integer. If we know where that spot is, we can try to do the same clipping there. Of course, the bug could be completely unrelated, this is just my suspicion.
Is it a priority to fix this?
sergiy-k commentedon Aug 23, 2019
I would like to understand whether we have to fix this issue in 3.1
cshung commentedon Aug 23, 2019
Does the bug repro in 3.0? I thought the change was introduced after it.
sergiy-k commentedon Aug 23, 2019
Oh, never mind. I'm sorry for the confusion. For some reason I thought that the change was merged in June instead of July. So it is not high priority but I would like have it fixed relatively soon (in a few weeks) in order to avoid accumulating test bugs.
cshung commentedon Aug 26, 2019
Today I attempted to repro this bug, and I am unable to, here is my exact setup.
These commands are all ran on a Ubuntu 16.04 LTS physical machine.
I build CoreCLR for Linux ARM from source:
This is the commit I was on:
4519204c19833104451003886b23c39218a48a23This is the command I used to build CoreCLR:
docker run --rm -v /home/andrewau/git/coreclr:/coreclr -w /coreclr -e ROOTFS_DIR=/crossrootfs/arm mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-cross-14.04-23cacb0-20190528233931 ./build.sh arm crossAfter the CoreCLR is built, I need to prepare the managed code to repro, to do that, I installed dotnet core preview 8, here is my
dotnet --infooutput:Using
dotnet new console, I created a blank console application, replaced the source code with the following:Then I published the app using
linux-armas my runtime identifier.dotnet publish -r linux-arm --self-containedWith that, I replaced all the coreclr binaries with my local build:
cp -R ~/git/coreclr/bin/Product/Linux.arm.Debug ~/repro/bin/Debug/netcoreapp3.0/linux-arm/publishFinally, I copied the bits to a Raspberry PI using
rsyncrsync -auz --info=progress2 ~/repro/bin/Debug/netcoreapp3.0/linux-arm/publish [hidden]@[hidden]:~/reproRunning the copied repro on the PI, here is what I get:
None of the numbers are negative.
I suspect there must be something special setup on the Linux arm devices used for the run, it might be running some sort of docker that mess it up.
Update:
Thanks to @hoyosjs, I was able to get docker running on the Raspberry PI, with that, I was able to run the scenario on the same docker image as it is on the CI. I still get exactly the same numbers. Also tried to run the scenario in a hot loop, it never outputs any negative numbers.
ViktorHofer commentedon Aug 29, 2019
With how many iterations did you test? If less than 1k I would try it again with that number. Some flaky tests are hard to reproduce.
hoyosjs commentedon Aug 29, 2019
I did 10k, no negative numbers. Don't know what the lab setup is to see if it's related.
sergiy-k commentedon Aug 29, 2019
Is it possible to get a crash dump from the lab?
ViktorHofer commentedon Aug 29, 2019
There were no crashes, the negative number was just reported as an xunit assertexception.
sergiy-k commentedon Aug 29, 2019
It will be very hard to get to the bottom of this issue without a crash dump given that the problem does not reproduce on local machines. We need to make the test generate a dump file when it fails. How do we do it?
It would be very cool if Xunit could be configured to generate a crush dump if an assert fails (maybe based on an attribute that we can set on demand).
ViktorHofer commentedon Aug 30, 2019
@bradwilson @onovotny is that somehow possible?
stephentoub commentedon Aug 30, 2019
You could Environment.FailFast instead of Assert.Whatever.
mangod9 commentedon Jul 24, 2020
@cshung do we know if this is still an issue which needs to be investigated?
cshung commentedon Jul 27, 2020
@mangod9
I have double checked our test exclusion list. It appears to me that the test is no longer excluded.
This issue concerns the GCTests, and it is not mentioned in the exclusion list. Searching
GCTestsin that file results in no match.Searching through the file, there is a match for
GCMemoryInfo.runtime/src/coreclr/tests/issues.targets
Line 1089 in 168409e
However, it is not the
GCTeststhat is being referred to in this issue. Upon careful inspection, this applies to mono only, so I think we are good to close this issue if the test is indeed running and no failure reported.@ViktorHofer, who initially disabled the test, to confirm that the test is not currently being disabled.
mangod9 commentedon Aug 14, 2020
Closing based on the comment above