dotnet/diagnostics

`System.OutOfMemoryException` during installation `dotnet-sos`, `dotnet-symbol`, `dotnet-dump` for `linux-riscv64`

ww898 opened this issue · 6 comments

Hi there,

I got the expection for dotnet tool install --global dotnet-sos on linux-riscv64 with 7.75Gb RAM :

$ dotnet tool install --global dotnet-sos
Skipping NuGet package signature verification.
Unhandled exception: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.Reflection.Emit.RuntimeTypeBuilder.<SetMethodIL>g____PInvoke|7_0(QCallModule __module_native, Int32 __tk_native, Int32 __isInitLocals_native, Byte* __body                      _native, Int32 __bodyLength_native, Byte* __LocalSig_native, Int32 __sigLength_native, Int32 __maxStackSize_native, ExceptionHandler* __exceptions_native, Int32 __numE                      xceptions_native, Int32* __tokenFixups_native, Int32 __numTokenFixups_native)
   at System.Reflection.Emit.RuntimeTypeBuilder.CreateTypeNoLock()
   at System.Reflection.Emit.RuntimeTypeBuilder.CreateTypeInfoImpl()
   at System.Reflection.Emit.RuntimeTypeBuilder.CreateTypeInfoCore()
   at System.Xml.Serialization.XmlSerializationReaderILGen.GenerateEnd()
   at System.Xml.Serialization.TempAssembly.GenerateRefEmitAssembly(XmlMapping[] xmlMappings, Type[] types)
   at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location)
   at System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace, String location)
   at System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace)
   at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
   at System.Xml.Serialization.XmlSerializer..ctor(Type type)
   at Microsoft.DotNet.ToolPackage.ToolConfigurationDeserializer.Deserialize(String pathToXml) in /_/src/Cli/dotnet/ToolPackage/ToolConfigurationDeserializer.cs:line 1                      9
   at Microsoft.DotNet.ToolPackage.ToolPackageInstance.DeserializeToolConfiguration(LockFileTargetLibrary library) in /_/src/Cli/dotnet/ToolPackage/ToolPackageInstance                      .cs:line 207
   at Microsoft.DotNet.ToolPackage.ToolPackageInstance.GetToolConfiguration() in /_/src/Cli/dotnet/ToolPackage/ToolPackageInstance.cs:line 131
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Microsoft.DotNet.ToolPackage.ToolPackageInstance.GetCommands() in /_/src/Cli/dotnet/ToolPackage/ToolPackageInstance.cs:line 88
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Microsoft.DotNet.ToolPackage.ToolPackageInstance.get_Commands() in /_/src/Cli/dotnet/ToolPackage/ToolPackageInstance.cs:line 40
   at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.Execute() in /_/src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallGlobalOrToolPathCom                      mand.cs:line 155
   at Microsoft.DotNet.Tools.Tool.Install.ToolInstallCommand.Execute() in /_/src/Cli/dotnet/commands/dotnet-tool/install/ToolInstallCommand.cs:line 51
   at Microsoft.DotNet.Cli.ToolInstallCommandParser.<>c.<ConstructCommand>b__17_0(ParseResult parseResult) in /_/src/Cli/dotnet/commands/dotnet-tool/install/ToolInstal                      lCommandParser.cs:line 98
   at System.CommandLine.Invocation.AnonymousCliAction.Invoke(ParseResult parseResult)
   at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult)
   at System.CommandLine.ParseResult.Invoke()
   at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient) in /_/src/Cli/dotnet/Program.cs:line 227

We currently don't support sos and dump on riscv. As for global tools, this would be the SDK work more than diagnostics.

@akoeplinger @steveisok do y'all know what the mono SDK support here is and who'd look at refemit in that case?

@akoeplinger @steveisok do y'all know what the mono SDK support here is and who'd look at refemit in that case?

As far as I know, we don't have a riscv runtime with mono.

Yeah this is running on coreclr.

Oh, sorry. Forget riscv is coreclr based. Thanks folks. That being said, this is an SDK tool issue. Let me ask what the state of SDK is currently.

You might be able to workaround by changing this here to always return SerializationMode.ReflectionOnly so XmlSerializer skips generating the temp assembly: https://github.com/dotnet/runtime/blob/0a5e97f46fb4ddf4f0ec41889243ed99e704fa95/src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializer.cs#L118