Skip to content
This repository has been archived by the owner on Oct 17, 2018. It is now read-only.

Crash on DNX451 under Mono 3.12.1 #68

Closed
markrendle opened this issue Mar 18, 2015 · 6 comments
Closed

Crash on DNX451 under Mono 3.12.1 #68

markrendle opened this issue Mar 18, 2015 · 6 comments
Assignees
Milestone

Comments

@markrendle
Copy link

Ran into this running an MVC application using the nightly DNX bits; managed to narrow it down to this repro command-line project:

project.json:

{
    "version": "1.0.0-*",
    "dependencies": {
        "Microsoft.AspNet.DataProtection": "1.0.0-*",
        "Microsoft.Framework.DependencyInjection": "1.0.0-*"
    },
    "commands": { 
        "run": "run"
    },
    "frameworks": {
        "dnx451": { }
    }
}

Program.cs:

using Microsoft.Framework.DependencyInjection;
using Microsoft.AspNet.DataProtection.KeyManagement;

namespace ConsoleApp1
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var services = new ServiceCollection();
            services.AddDataProtection();
            var provider = services.BuildServiceProvider();
            var encryptor = provider.GetService<IKeyManager>();
        }
    }
}

Crash text:

Can't find custom attr constructor image: /home/mark/.dnx/packages/Microsoft.AspNet.Cryptography.Internal/1.0.0-beta4-11051/lib/dnx451/Microsoft.AspNet.Cryptography.Internal.dll mtoken: 0x0a000004
* Assertion at class.c:5695, condition `!mono_loader_get_last_error ()' not met

Stacktrace:

  at <unknown> <0xffffffff>
  at Microsoft.Framework.DependencyInjection.DataProtectionServices/<>c.<GetDefaultServices>b__0_0 (System.IServiceProvider) <0x001c7>
  at Microsoft.Framework.DependencyInjection.ServiceLookup.FactoryService.Invoke (Microsoft.Framework.DependencyInjection.ServiceProvider) <0x0002d>
  at Microsoft.Framework.DependencyInjection.ServiceProvider/ScopedCallSite.Invoke (Microsoft.Framework.DependencyInjection.ServiceProvider) <0x00081>
  at Microsoft.Framework.DependencyInjection.ServiceProvider/SingletonCallSite.Invoke (Microsoft.Framework.DependencyInjection.ServiceProvider) <0x0001f>
  at Microsoft.Framework.DependencyInjection.ServiceProvider/<>c__DisplayClass8_0.<RealizeService>b__0 (Microsoft.Framework.DependencyInjection.ServiceProvider) <0x00123>
  at Microsoft.Framework.DependencyInjection.ServiceProvider.GetService (System.Type) <0x000bd>
  at Microsoft.Framework.DependencyInjection.ServiceProviderExtensions.GetService<T> (System.IServiceProvider) <0x0002d>
  at Microsoft.AspNet.DataProtection.KeyManagement.XmlKeyManager..ctor (System.IServiceProvider) <0x000ff>
  at Microsoft.Framework.DependencyInjection.DataProtectionServiceDescriptors/<>c.<IKeyManager_Default>b__8_0 (System.IServiceProvider) <0x00027>
  at Microsoft.Framework.DependencyInjection.ServiceLookup.FactoryService.Invoke (Microsoft.Framework.DependencyInjection.ServiceProvider) <0x0002d>
  at Microsoft.Framework.DependencyInjection.ServiceProvider/ScopedCallSite.Invoke (Microsoft.Framework.DependencyInjection.ServiceProvider) <0x00081>
  at Microsoft.Framework.DependencyInjection.ServiceProvider/SingletonCallSite.Invoke (Microsoft.Framework.DependencyInjection.ServiceProvider) <0x0001f>
  at Microsoft.Framework.DependencyInjection.ServiceProvider/<>c__DisplayClass8_0.<RealizeService>b__0 (Microsoft.Framework.DependencyInjection.ServiceProvider) <0x00123>
  at Microsoft.Framework.DependencyInjection.ServiceProvider.GetService (System.Type) <0x000bd>
  at Microsoft.Framework.DependencyInjection.ServiceProviderExtensions.GetService<T> (System.IServiceProvider) <0x0002d>
  at ConsoleApp1.Program.Main (string[]) <0x000e3>                                                                                                                               
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <0xffffffff>                                                                     
  at <unknown> <0xffffffff>                                                                                                                                                      
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) <0xffffffff>                       
  at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <0x000d7>                    
  at System.Reflection.MethodBase.Invoke (object,object[]) <0x0002a>                                                                                                             
  at Microsoft.Framework.Runtime.Common.EntryPointExecutor.Execute (System.Reflection.Assembly,string[],System.IServiceProvider) <0x0010b>                                       
  at Microsoft.Framework.ApplicationHost.Program.ExecuteMain (Microsoft.Framework.Runtime.DefaultHost,string,string[]) <0x005af>                                                 
  at Microsoft.Framework.ApplicationHost.Program.Main (string[]) <0x0043f>                                                                                                       
  at (wrapper runtime-invoke) <Module>.runtime_invoke_object__this___object (object,intptr,intptr,intptr) <0xffffffff>                                                           
  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) <0xffffffff>
  at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <0x000d7>
  at System.Reflection.MethodBase.Invoke (object,object[]) <0x0002a>
  at Microsoft.Framework.Runtime.Common.EntryPointExecutor.Execute (System.Reflection.Assembly,string[],System.IServiceProvider) <0x0010b>
  at dnx.host.Bootstrapper.RunAsync (System.Collections.Generic.List`1<string>) <0x0045f>
  at dnx.host.RuntimeBootstrapper.ExecuteAsync (string[]) <0x00737>
  at dnx.host.RuntimeBootstrapper.Execute (string[]) <0x00057>
  at EntryPoint.Main (string[]) <0x0029b>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

        /usr/lib/libmonosgen-2.0.so.1(+0xcf10a) [0x7f13221dd10a]
        /usr/lib/libpthread.so.0(+0x10740) [0x7f1321f01740]
        /usr/lib/libc.so.6(gsignal+0x37) [0x7f1321b814b7]
        /usr/lib/libc.so.6(abort+0x16a) [0x7f1321b8288a]
        /usr/lib/libmonosgen-2.0.so.1(+0x25a5c9) [0x7f13223685c9]
        /usr/lib/libmonosgen-2.0.so.1(+0x25a83c) [0x7f132236883c]
        /usr/lib/libmonosgen-2.0.so.1(+0x25a9d3) [0x7f13223689d3]
        /usr/lib/libmonosgen-2.0.so.1(+0x149544) [0x7f1322257544]
        /usr/lib/libmonosgen-2.0.so.1(+0x1493be) [0x7f13222573be]
        /usr/lib/libmonosgen-2.0.so.1(mono_field_from_token+0x115) [0x7f132227ef35]
        /usr/lib/libmonosgen-2.0.so.1(+0x792c7) [0x7f13221872c7]
        /usr/lib/libmonosgen-2.0.so.1(+0x461d6) [0x7f13221541d6]
        /usr/lib/libmonosgen-2.0.so.1(+0x49a1c) [0x7f1322157a1c]
        /usr/lib/libmonosgen-2.0.so.1(+0x4a48b) [0x7f132215848b]
        /usr/lib/libmonosgen-2.0.so.1(+0xd1781) [0x7f13221df781]
        [0x40dd1172]

Debug info from gdb:


=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Aborted (core dumped)

System Info:

  • Arch Linux (kernel 3.14.35)
  • Mono 3.12.1 from Arch packages
  • DNX 1.0.0-beta4-11308 Mono
  • Microsoft.AspNet.DataProtection 1.0.0-beta4-11051
  • Microsoft.AspNet.Cryptography.Internal 1.0.0-beta4-11051
@nosami
Copy link
Member

nosami commented Mar 18, 2015

Looks like the same issue as this one dotnet/aspnetcore#351

@lefb766
Copy link

lefb766 commented Mar 18, 2015

Hmm, curious. I cannot get that error but another one.

My env is almost the same as yours: Arch Linux, same versions of Mono and DNX, but newer kernel revision (3.18.6-1-ARCH).

k run says:

System.Security.SecurityException: No access to the given key ---> System.UnauthorizedAccessException: Access to the path "/etc/mono/registry" is denied.
  at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in <filename unknown>:0 
  at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in <filename unknown>:0 
  at System.IO.DirectoryInfo.Create () [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo:Create ()
  at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in <filename unknown>:0 
  at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in <filename unknown>:0 
  at Microsoft.Win32.KeyHandler..ctor (Microsoft.Win32.RegistryKey rkey, System.String basedir, Boolean is_volatile) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at Microsoft.Win32.KeyHandler..ctor (Microsoft.Win32.RegistryKey rkey, System.String basedir, Boolean is_volatile) [0x00000] in <filename unknown>:0 
  at Microsoft.Win32.KeyHandler..ctor (Microsoft.Win32.RegistryKey rkey, System.String basedir) [0x00000] in <filename unknown>:0 
  at Microsoft.Win32.KeyHandler.Lookup (Microsoft.Win32.RegistryKey rkey, Boolean createNonExisting) [0x00000] in <filename unknown>:0 
  at Microsoft.Win32.UnixRegistryApi.OpenSubKey (Microsoft.Win32.RegistryKey rkey, System.String keyname, Boolean writable) [0x00000] in <filename unknown>:0 
  at Microsoft.Win32.RegistryKey.OpenSubKey (System.String name, Boolean writable) [0x00000] in <filename unknown>:0 
  at Microsoft.Win32.RegistryKey.OpenSubKey (System.String name) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) Microsoft.Win32.RegistryKey:OpenSubKey (string)
  at Microsoft.AspNet.DataProtection.RegistryPolicyResolver.ResolveDefaultPolicy () [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.DependencyInjection.DataProtectionServices+<GetDefaultServices>d__0.MoveNext () [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.DependencyInjection.ServiceCollectionExtensions.TryAdd (IServiceCollection collection, IEnumerable`1 descriptors) [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.DependencyInjection.DataProtectionServiceCollectionExtensions.AddDataProtection (IServiceCollection services) [0x00000] in <filename unknown>:0 
  at Program.Main () [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
System.UnauthorizedAccessException: Access to the path "/etc/mono/registry" is denied.
  at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in <filename unknown>:0 
  at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in <filename unknown>:0 
  at System.IO.DirectoryInfo.Create () [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo:Create ()
  at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in <filename unknown>:0 
  at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in <filename unknown>:0 
  at Microsoft.Win32.KeyHandler..ctor (Microsoft.Win32.RegistryKey rkey, System.String basedir, Boolean is_volatile) [0x00000] in <filename unknown>:0 

This error looks different with the one you got, though it also seems to relate to DataProtection.

@markrendle
Copy link
Author

Going to try with Mono 4.1 built from git clone

@markrendle
Copy link
Author

Right, with Mono 4.1.0 build from master, I got:

System.Security.SecurityException: No access to the given key ---> System.UnauthorizedAccessException: Access to the path "/usr/local/etc/mono/registry" is denied.
  at System.IO.Directory.CreateDirectoriesInternal (System.String path)<0x7f39e137f4b0 + 0x0011d> in <filename unknown>:0 
  at System.IO.Directory.CreateDirectory (System.String path)<0x7f39e137f310 + 0x0009d> in <filename unknown>:0 
  at System.IO.DirectoryInfo.Create ()<0x7f39e1381070 + 0x00013> in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo:Create ()
  at System.IO.Directory.CreateDirectoriesInternal (System.String path)<0x7f39e137f4b0 + 0x000d0> in <filename unknown>:0 
  at System.IO.Directory.CreateDirectory (System.String path)<0x7f39e137f310 + 0x0009d> in <filename unknown>:0 
  at Microsoft.Win32.KeyHandler..ctor (Microsoft.Win32.RegistryKey rkey, System.String basedir, Boolean is_volatile)<0x7f39e12dcfc0 + 0x00082> in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at Microsoft.Win32.KeyHandler..ctor (Microsoft.Win32.RegistryKey rkey, System.String basedir, Boolean is_volatile)<0x7f39e12dcfc0 + 0x000d3> in <filename unknown>:0 
  at Microsoft.Win32.KeyHandler..ctor (Microsoft.Win32.RegistryKey rkey, System.String basedir)<0x7f39e12dcfa0 + 0x00018> in <filename unknown>:0 
  at Microsoft.Win32.KeyHandler.Lookup (Microsoft.Win32.RegistryKey rkey, Boolean createNonExisting)<0x7f39e12de6c0 + 0x001ed> in <filename unknown>:0 
  at Microsoft.Win32.UnixRegistryApi.OpenSubKey (Microsoft.Win32.RegistryKey rkey, System.String keyname, Boolean writable)<0x7f39e12e1190 + 0x0002b> in <filename unknown>:0 
  at Microsoft.Win32.RegistryKey.OpenSubKey (System.String name, Boolean writable)<0x7f39e12db890 + 0x0005a> in <filename unknown>:0 
  at Microsoft.Win32.RegistryKey.OpenSubKey (System.String name)<0x7f39e12db870 + 0x00013> in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) Microsoft.Win32.RegistryKey:OpenSubKey (string)
  at Microsoft.AspNet.DataProtection.RegistryPolicyResolver.ResolveDefaultPolicy ()<0x415e30c0 + 0x00038> in <filename unknown>:0 
  at Microsoft.Framework.DependencyInjection.DataProtectionServices+<GetDefaultServices>d__0.MoveNext ()<0x415e2470 + 0x002e3> in <filename unknown>:0 
  at Microsoft.Framework.DependencyInjection.ServiceCollectionExtensions.TryAdd (IServiceCollection collection, IEnumerable`1 descriptors)<0x415e2220 + 0x0007f> in <filename unknown>:0 
  at Microsoft.Framework.DependencyInjection.DataProtectionServiceCollectionExtensions.AddDataProtection (IServiceCollection services)<0x415e1b40 + 0x00023> in <filename unknown>:0 
  at ConsoleApp1.Program.Main (System.String[] args)<0x415e18f0 + 0x0003b> in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)<0x7f39e13de390 + 0x000b9> in <filename unknown>:0 
System.UnauthorizedAccessException: Access to the path "/usr/local/etc/mono/registry" is denied.
  at System.IO.Directory.CreateDirectoriesInternal (System.String path)<0x7f39e137f4b0 + 0x0011d> in <filename unknown>:0 
  at System.IO.Directory.CreateDirectory (System.String path)<0x7f39e137f310 + 0x0009d> in <filename unknown>:0 
  at System.IO.DirectoryInfo.Create ()<0x7f39e1381070 + 0x00013> in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo:Create ()
  at System.IO.Directory.CreateDirectoriesInternal (System.String path)<0x7f39e137f4b0 + 0x000d0> in <filename unknown>:0 
  at System.IO.Directory.CreateDirectory (System.String path)<0x7f39e137f310 + 0x0009d> in <filename unknown>:0 
  at Microsoft.Win32.KeyHandler..ctor (Microsoft.Win32.RegistryKey rkey, System.String basedir, Boolean is_volatile)<0x7f39e12dcfc0 + 0x00082> in <filename unknown>:0

When I created /usr/local/etc/mono/registry and chmod 777 /usr/local/etc/mono/registry, the repro project runs fine.

But this all looks to me like DataProtection is trying to do Windows things when it shouldn't.

@GrabYourPitchforks
Copy link
Contributor

The first issue ("assertion at class.c") is #55, resolution is to update Mono.

The registry issue is a regression, and we'll get to it shortly. Thanks for the report!

@markrendle
Copy link
Author

Confirm that this has fixed the problem as long as using Mono 4.1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants