runtime icon indicating copy to clipboard operation
runtime copied to clipboard

[Arm64] Infinite recursion while looking for resource

Open sdmaclea opened this issue 9 years ago • 15 comments

While testing 0310a1e, found five failures with the same failure mechanism.

JIT.Regression/JitBlue/DevDiv_278372/DevDiv_278372/DevDiv_278372.sh
JIT/Regression/JitBlue/DevDiv_362706/DevDiv_362706/DevDiv_362706.sh
JIT/Regression/JitBlue/DevDiv_367099/DevDiv_367099/DevDiv_367099.sh
JIT/Regression/JitBlue/DevDiv_370233/DevDiv_370233/DevDiv_370233.sh
JIT/Regression/JitBlue/DevDiv_377155/DevDiv_377155/DevDiv_377155.sh
JIT.Regression.JitBlue.DevDiv_278372.DevDiv_278372.DevDiv_278372 (from (report.xml))

Stacktrace

BEGIN EXECUTION
/usr/bin/time /home/vmjenkins/workspace/Dotnet/build_and_test/bin/tests/pr1/Tests/coreoverlay/corerun DevDiv_278372.exe
Assert Failure
Expression: [Recursive resource lookup bug]
Description: Infinite recursion during resource lookup within System.Private.CoreLib.  This may be a bug in System.Private.CoreLib, or potentially in certain extensibility points such as assembly resolve events or CultureInfo names.  Resource name: Arg_AccessViolationException
Stack Trace:
   at System.Diagnostics.StackTrace.GetStackFramesInternal(StackFrameHelper sfh, Int32 iSkip, Boolean fNeedFileInfo, Exception e)
   at System.Diagnostics.StackFrameHelper.InitializeSourceInfo(Int32 iSkip, Boolean fNeedFileInfo, Exception exception)
   at System.Diagnostics.StackTrace.CaptureStackTrace(Int32 iSkip, Boolean fNeedFileInfo, Thread targetThread, Exception e)
   at System.Diagnostics.StackTrace..ctor(Int32 skipFrames, Boolean fNeedFileInfo)
   at System.Diagnostics.Assert.Fail(String conditionString, String message, String windowTitle, Int32 exitCode, TraceFormat stackTraceFormat, Int32 numStackFramesToSkip)
   at System.SR.InternalGetResourceString(String key)
   at System.SR.GetResourceString(String resourceKey, String defaultString)
   at System.AccessViolationException..ctor()
   at System.String.Equals(String a, String b)
   at System.Globalization.CultureData.get_CultureName()
   at System.Globalization.CultureInfo.InitializeFromName(String name, Boolean useUserOverride)
   at System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride)
   at System.Globalization.CultureInfo.GetCultureByName(String name, Boolean userOverride)
   at System.Globalization.CultureInfo.GetUserDefaultCulture()
   at System.Globalization.CultureInfo.Init()
   at System.Globalization.CultureInfo..cctor()
   at System.Globalization.CultureInfo.GetCultureInfoHelper(Int32 lcid, String name, String altName)
   at System.Globalization.CultureInfo.GetCultureInfo(String name)
   at System.Resources.ManifestBasedResourceGroveler.GetNeutralResourcesLanguage(Assembly a, UltimateResourceFallbackLocation& fallbackLocation)
   at System.Resources.ResourceManager.CommonAssemblyInit()
   at System.Resources.ResourceManager..ctor(Type resourceSource)
   at System.SR.InternalGetResourceString(String key)
   at System.SR.GetResourceString(String resourceKey, String defaultString)
   at System.AccessViolationException..ctor()
   at System.AppDomainSetup..ctor(AppDomainSetup copy, Boolean copyDomainBoundData)
   at System.AppDomain.Setup(Object arg)
Expected: 100
Actual: 35
END EXECUTION - FAILED

sdmaclea avatar May 01 '17 17:05 sdmaclea

@jkotas Can you mention someone who might know what caused this.

sdmaclea avatar May 01 '17 17:05 sdmaclea

These tests run with COMPlus_JitStressRegs=0x200. It looks like a bug in the JIT that repros in this mode. You should see the crash on any test if you set COMPlus_JitStressRegs=0x200.

jkotas avatar May 01 '17 17:05 jkotas

cc @dotnet/jit-contrib

sdmaclea avatar May 01 '17 17:05 sdmaclea

For reference, this issue did not exist in this version: 8291db8.

sdmaclea avatar May 01 '17 17:05 sdmaclea

I ran a git bisect. c983bb86 dotnet/coreclr#11040 was the first version which had this issue. This disabled loading the S.P.C as a NI (on arm64).

sdmaclea avatar May 02 '17 16:05 sdmaclea

@sdmaclea , do you still get this [Recursive resource lookup bug] message? I have this same problem with ARM(32bit) build running on RPi3/UbuntuMate16.04. My simple program is like

static void Main(string[] args)
{
  Console.WriteLine("Hello World!");
  throw new ArgumentException("MyException");
}

with overlay from build binaries of master branch, debug build of CoreCLR and CoreFX.

cd overlay
cp -v ../corefx/bin/runtime/netcoreapp-Linux-Debug-x64/*.dll .
cp -v ../corefx/bin/Linux.arm.Debug/native/*.so .
cp -vR ../coreclr/bin/Product/Linux.arm.Debug/* .
./corerun mysample.dll

Could there be some problems with my environment?

Edit: Release build works OK.

seanshpark avatar Jun 19 '17 09:06 seanshpark

@seanshpark I was seeing the problem when System.Private.Corelib.dll was not loaded as a native image. When I changed my workflow to use a native image, the problem was ~resolved. I left the issue open because I think there is still an underlying issue. IL version of S.P.C.dll should work.

sdmaclea avatar Jun 19 '17 14:06 sdmaclea

Still got this assert on ARM32 (Edit: Release build works OK) with next assembly:

using System;

class Test
{
    static void Main()
    {
        for (int i = 0; i < 1000000; i++)
        {
            try
            {
                throw new NullReferenceException();
            }
            catch {}
        }
    }
}
Assert Failure
Expression: [Recursive resource lookup bug]
Description: Infinite recursion during resource lookup within System.Private.CoreLib.  This may be a bug in System.Private.CoreLib, or potentially in certain extensibility points such as assembly resolve events or CultureInfo names.  Resource name: IO_EOF_ReadBeyondEOF
Stack Trace:
   at System.SR.InternalGetResourceString(String key)
   at System.SR.GetResourceString(String resourceKey, String defaultString)
   at System.SR.get_IO_EOF_ReadBeyondEOF()
   at System.IO.__Error.EndOfFile()
   at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
   at System.IO.BinaryReader.ReadInt32()
   at System.Resources.ManifestBasedResourceGroveler.CreateResourceSet(Stream store, Assembly assembly)
   at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
   at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
   at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
   at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
   at System.SR.InternalGetResourceString(String key)
   at System.SR.GetResourceString(String resourceKey, String defaultString)
   at System.SR.get_IO_EOF_ReadBeyondEOF()
   at System.IO.__Error.EndOfFile()
   at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
   at System.IO.BinaryReader.ReadInt32()
   at System.Resources.ManifestBasedResourceGroveler.CreateResourceSet(Stream store, Assembly assembly)
   at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
   at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
   at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
   at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
   at System.SR.InternalGetResourceString(String key)
   at System.SR.GetResourceString(String resourceKey, String defaultString)
   at System.SR.get_Arg_NullReferenceException()
   at System.NullReferenceException..ctor()
   at Test.Main()

Buyduck avatar Oct 17 '17 17:10 Buyduck

Sometimes got segmentation fault on ARM32 with Release version too (with AboveStackLimit.cs from standard CoreCLR tests), seems, like same problem:

jenkins@hoult-odroid:~/dotnet-arm$ for i in `seq 100`; do ./overlay/corerun /mnt/nfsroot/tmp/i.vagin/x86/WindowsCoreclrTests/Regressions/coreclr/0099/AboveStackLimit/AboveStackLimit.exe > output; if [ $? -ne 100 ]; then echo "success"; break; fi; echo "done $i"; done
done 1
done 2
done 3
done 4
done 5
done 6
done 7
done 8
done 9
done 10
done 11
done 12
done 13
done 14
done 15
done 16
Segmentation fault
success

vitalik322 avatar Nov 13 '17 11:11 vitalik322

It's been a while -- do we think this is still an active issue? Can anyone repro this with latest bits?

AndyAyersMS avatar Feb 15 '18 23:02 AndyAyersMS

@AndyAyersMS Yes, it's still active, but we found out reason: https://github.com/dotnet/coreclr/issues/15074 So addressed to that issue, current issue, probably, could be closed too.

Buyduck avatar Feb 16 '18 11:02 Buyduck

@sdmaclea thoughts? Could this just be a "please use a newer version of clang" thing?

AndyAyersMS avatar Feb 16 '18 21:02 AndyAyersMS

@sdmaclea Is this issue still live for arm64 Linux? We updated arm32 Linux to build with clang5.0, which apparently fixed it for arm32.

BruceForstall avatar Apr 25 '18 00:04 BruceForstall

The issue has been resolved for arm64 for a long time.

sdmaclea avatar Apr 25 '18 00:04 sdmaclea

Closing based on fixed on arm32 and arm64

sdmaclea avatar Apr 25 '18 00:04 sdmaclea