dnx kestrel "System.EntryPointNotFoundException: uv_loop_size"
Asked Answered
H

3

6

I'm trying to run an unmodified Web Api application created by yo aspnet.

I'm getting this error:

System.EntryPointNotFoundException: uv_loop_size
  at (wrapper managed-to-native) Microsoft.AspNet.Server.Kestrel.Networking.Libuv+NativeDarwinMonoMethods:uv_loop_size ()
  at Microsoft.AspNet.Server.Kestrel.Networking.Libuv.loop_size () <0x42615b8 + 0x00014> in <filename unknown>:0 
  at Microsoft.AspNet.Server.Kestrel.Networking.UvLoopHandle.Init (Microsoft.AspNet.Server.Kestrel.Networking.Libuv uv) <0x4261528 + 0x0002b> in <filename unknown>:0 
  at Microsoft.AspNet.Server.Kestrel.KestrelThread.ThreadStart (System.Object parameter) <0x4261160 + 0x0005f> in <filename unknown>:0 

Any ideas?

dnvm list output:

Active Version              Runtime Architecture OperatingSystem Alias
------ -------              ------- ------------ --------------- -----
       1.0.0-rc1-final      coreclr x64          darwin          
       1.0.0-rc1-final      mono                 linux/osx       
  *    1.0.0-rc2-16177      mono                 linux/osx       default

mono version

Mono JIT compiler version 4.2.1 (explicit/6dd2d0d Tue Nov 10 18:01:18 EST 2015)

Update

I ran

 export DYLD_FALLBACK_LIBRARY_PATH=/Users/Andy/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-rc1-final/runtimes/osx/native/

which ended up giving me a different error when running dnx web:

System.DllNotFoundException: libc.dylib
  at (wrapper managed-to-native) System.IO.KeventWatcher:kqueue ()
  at System.IO.KeventWatcher.GetInstance (IFileWatcher& watcher) <0x105a29310 + 0x000f3> in <filename unknown>:0 
  at System.IO.FileSystemWatcher.InitWatcher () <0x105a28fa0 + 0x0012c> in <filename unknown>:0 
  at System.IO.FileSystemWatcher..ctor (System.String path, System.String filter) <0x105a28d00 + 0x00114> in <filename unknown>:0 
  at System.IO.FileSystemWatcher..ctor (System.String path) <0x105a28cc0 + 0x00023> in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileSystemWatcher:.ctor (string)
  at Microsoft.AspNet.FileProviders.PhysicalFilesWatcher..ctor (System.String root) <0x105a285b0 + 0x00154> in <filename unknown>:0 
  at Microsoft.AspNet.FileProviders.PhysicalFileProvider..ctor (System.String root) <0x105a282d0 + 0x000e4> in <filename unknown>:0 
  at Microsoft.AspNet.Hosting.HostingEnvironmentExtensions.Initialize (IHostingEnvironment hostingEnvironment, System.String applicationBasePath, IConfiguration config) <0x105a27f20 + 0x001ea> in <filename unknown>:0 
  at Microsoft.AspNet.Hosting.WebHostBuilder.Build () <0x105a1a860 + 0x000b8> in <filename unknown>:0 
  at Microsoft.AspNet.Hosting.WebApplication.Run (System.Type startupType, System.String[] args) <0x105560990 + 0x00216> in <filename unknown>:0 
  at Microsoft.AspNet.Hosting.WebApplication.Run (System.String[] args) <0x10555fef0 + 0x0001a> in <filename unknown>:0 
  at Microsoft.AspNet.Hosting.Program.Main (System.String[] args) <0x10555fec0 + 0x00014> in <filename unknown>:0 
  at Microsoft.AspNet.Server.Kestrel.Program.Main (System.String[] args) <0x10555fc90 + 0x000b5> 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) <0x1050027a0 + 0x000b7> in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () in <filename unknown>:line 0
   at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute (System.Reflection.Assembly assembly, System.String[] args, IServiceProvider serviceProvider) in <filename unknown>:line 0
   at Microsoft.Dnx.ApplicationHost.Program+<>c__DisplayClass3_0.<ExecuteMain>b__0 () in <filename unknown>:line 0
   at System.Threading.Tasks.Task`1[TResult].InnerInvoke () in <filename unknown>:line 0
   at System.Threading.Tasks.Task.Execute () in <filename unknown>:line 0

Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
   at System.IO.FileSystemWatcher.Stop () in <filename unknown>:line 0
   at System.IO.FileSystemWatcher.Finalize () in <filename unknown>:line 0
Hilton answered 21/11, 2015 at 19:2 Comment(3)
Regarding your update: libc.dylib is located in /usr/lib, not sure if you had an existing "DYLD_FALLBACK_LIBRARY_PATH" set, 'export DYLD_FALLBACK_LIBRARY_PATH=/libuv/dir/locaation:/usr/lib:$DYLD_FALLBACK_LIBRARY_PATH' so you do not reset an existing DYLD_FALLBACK_LIBRARY_PATH env var...Transude
I'm in the exact same situation as Andy (including the updated problem). I tried your suggestion @RobertN to add /usr/lib to the env var and I'm back to the original "uv_loop_size" error. It may be worth noting that I did not have this problem with beta8. I only have it now that I updated to rc1-final.Patently
@KevinCraft, checkout out the comment thread from Pawel in the answer thread below as native lib loading changed in the RC release @ blog.3d-logic.com/2015/11/10/…Transude
H
0

After many reinstalls of Mono, Visual Code, Xamarin Studio, DNX, libuv, an upgrade of Node and RoberN giving me some clear pointers, I figured I should check my PATH env variable. Sure enough, as soon as I added /usr/lib/:/usr/local/lib to my PATH, it all started working!

dnx web

Hosting environment: Production
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.

Success!

Hilton answered 24/11, 2015 at 0:9 Comment(3)
Interesting... ` /usr/lib/:/usr/local/lib to my PATH` if that worked, then MS is doing some very non-std dyld path probing as you should never have to include lib dirs in your 'execution` path...Transude
Again, if that works., that actually should be reported as a bug on non-Windows platformsTransude
I'm not too familiar with what should be in my path or what not but yes, it works. Any idea how to log the file access when running dnx web to see where it actually looks ala procmon on windows?Hilton
T
3

FYI: This is not mono related

It is not finding the libuv native library via the System.Net.Libuv assembly:

https://github.com/dotnet/corefxlab/blob/d76ebe8ab5ed058d3d6903939ab0e4ee4e19b773/src/System.Net.Libuv/src/System/Net/Libuv/Interop.cs

1st) Run dnvm list -detailed to determine the location of dnx runtimes that you are using, i.e.

Active Version              Runtime Architecture OperatingSystem Alias   Location
------ -------              ------- ------------ --------------- -----   --------
       1.0.0-beta8          mono                 linux/osx               ~/.dnx/runtimes
       1.0.0-rc1-final      mono                 linux/osx               ~/.dnx/runtimes
  *    1.0.0-rc2-16177      mono                 linux/osx       default ~/.dnx/runtimes

2nd) My dnx installs are $HOME/.dnx/runtime (the default), so I can run find ~/.dnx/packages -name "libuv*"

/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-beta8/runtimes/osx/native/libuv.dylib
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-beta8/runtimes/win10-arm/native/libuv.dll
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-beta8/runtimes/win7-x64/native/libuv.dll
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-beta8/runtimes/win7-x86/native/libuv.dll
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-rc1-final/runtimes/osx/native/libuv.dylib
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-rc1-final/runtimes/win10-arm/native/libuv.dll
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-rc1-final/runtimes/win7-x64/native/libuv.dll
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-rc1-final/runtimes/win7-x86/native/libuv.dll

Once you find where your libuv.dylib does live on your system, you can set the env. var DYLD_FALLBACK_LIBRARY_PATH to that directory:

export DYLD_FALLBACK_LIBRARY_PATH=/your/libuv/directory/location:$DYLD_FALLBACK_LIBRARY_PATH

Run your dmvm cmd again:

dnvm exec 1.0.0-rc2-16177 dnx web

Note:

On OS-X libuv is also available via brew @ stable version 1.7.5 but I have not tried it as MS is not versioning their libuv.dylib build so I am not sure if it is a custom version or not ...(?)

otool -L /Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-rc1-final/runtimes/osx/native/libuv.dylib
/Users/sushi/.dnx/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-rc1-final/runtimes/osx/native/libuv.dylib:
    /Users/asplab/Documents/buildAgent/temp/buildTmp/fs-poll-5b0daf.out (compatibility version 0.0.0, current version 0.0.0)
Transude answered 22/11, 2015 at 1:21 Comment(13)
Thanks, that's great info. I'll do some digging later today.Hilton
are you sure that it's not DYLD_FALLBACK_LIBRARY_PATH instead of DYLIB_FALLBACK_LIBRARY_PATH ?Hilton
@RobertN - You can find what version is shipped with Kestrel here: github.com/aspnet/libuv-build/tree/dev/submodules. Currently it's 1.7.3 with a commit that makes multiple loops work on Windows (a contribution our team made to libuv)Garrido
@Hilton , you are correct, serves me right for typing freehand and not cut/pasting ;-) I corrected the answer, thanksTransude
@Pawel, awesome, thanks for the info, did not think to look at the submodules... I still would love it if the version info was stub'd in as "current version 0.0.0" tells me I have to hope I have the right one ;-)Transude
Thanks Robert, however, I only get the above error if I include a single path. If I add any others, I get the original error which I assume is because the path isn't working. Any idea whether it's normal to have to set these env vars and if not, why I might be needing to do this?Hilton
Usually the app defines any custom dyld paths, usually through the env. vars within the app itself..., but sometimes not... You will see DYLD_FALLBACK_LIBRARY_PATH, DYLD_LIBRARY_PATH being set a lot in the Mono world on OS-X (and as a parallel LD_LIBRARY_PATH on Linux) since there is no 'app' wrapper around most cmd line apps. A lot of the Mono scripts (mcs, mono, etc.. will set these env vars. to pickup their libraries, but the end-user must add any custom ones for each of their appsTransude
If you were defining multiple paths without using a colon but some other separator I would fully expect the original error to reappear...Transude
thanks for the info. Any idea why it might not work on my machine without these hints? Does it work for you out of the box?Hilton
@RobertN the idea is that you should not need to know the libuv version since it is part of the Kestrel package. The way ASP.NET 5 loads native libraries has changed in RC1 and I would like to know if it is a bug or what the issue is. I wrote a blog post about this feature here: blog.3d-logic.com/2015/11/10/…Garrido
@Pawel, thanks for link!!... now I understand why my dnx setup 'works', but started becoming failing/flakey at times as I DO have a custom lubuv.dylib and it was(!) in my path (custom node.js install) and the reason that our OS-X servers will not run at all now, but our Linux boxes were fine with the same code. If probing $PATH is now standard for OS-X (and not Linux), we will fork the project to unbreak that in our env. as that is something we would want to never happen.Transude
@Pawel, I would rather have a dylb load failure to understand that it is a kestrel config problem in the project.lock.json then pickup an unknown version from the path... that would be scary for us in a production environment.Transude
I've tried just about everything on this thread. I still keep getting ``` System.EntryPointNotFoundException: uv_loop_size``` I installed Mono with Homebrew. Can anyone point me in the right direction?Pants
H
0

After many reinstalls of Mono, Visual Code, Xamarin Studio, DNX, libuv, an upgrade of Node and RoberN giving me some clear pointers, I figured I should check my PATH env variable. Sure enough, as soon as I added /usr/lib/:/usr/local/lib to my PATH, it all started working!

dnx web

Hosting environment: Production
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.

Success!

Hilton answered 24/11, 2015 at 0:9 Comment(3)
Interesting... ` /usr/lib/:/usr/local/lib to my PATH` if that worked, then MS is doing some very non-std dyld path probing as you should never have to include lib dirs in your 'execution` path...Transude
Again, if that works., that actually should be reported as a bug on non-Windows platformsTransude
I'm not too familiar with what should be in my path or what not but yes, it works. Any idea how to log the file access when running dnx web to see where it actually looks ala procmon on windows?Hilton
H
0

In case anyone comes here looking for another solution...

I tried all of the above, including multiple re-installs of everything and PATH updates without success, and finally switched to CoreCLR as per the solution here and it finally worked!

dnvm install 1.0.0-rc1-update1 -r coreclr -arch x64

dnvm use 1.0.0-rc1-update1 -r coreclr -arch x64

dnvm list

then, go to your project and try it again

dnx web
Hummel answered 19/1, 2016 at 18:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.