LibUV error -14 EFAULT Bad address is system call argument
I'm trying to evaluate Kestrel in my application and am getting faults when Kestrel I think is trying to bind to an address and failing at the LibUV layer. I have LibUV 1.10.1 installed.
The error I'm getting is:
System.AggregateException: One or more errors occurred. ---> Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -14 EFAULT bad address in system call argument --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00014] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00052] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Threading.Tasks.Task.Wait () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0 at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelEngine.CreateServer (Microsoft.AspNetCore.Server.Kestrel.ServerAddress address) [0x00144] in <43555eec0dc34d2abb4f01227fa5a2e9>:0 ---> (Inner Exception #0) Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -14 EFAULT bad address in system call argument<---
[ERROR] FATAL UNHANDLED EXCEPTION: System.AggregateException: One or more errors occurred. ---> Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -14 EFAULT bad address in system call argument --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00014] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00052] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Threading.Tasks.Task.Wait () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0 at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelEngine.CreateServer (Microsoft.AspNetCore.Server.Kestrel.ServerAddress address) [0x00144] in <43555eec0dc34d2abb4f01227fa5a2e9>:0 ---> (Inner Exception #0) Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -14 EFAULT bad address in system call argument<---
Not sure if this is a new bug or something I've done wrong here. Any help would be appreciated.
My app code looks like
WebHostBuilder()
.UseUrls("http://127.0.0.1:8083")
.UseKestrel()
.UseStartup<Startup>()
.Build()
.Run()
Can you be more specific? What OS? What do you mean you have libuv "installed". It comes with .NET Core, did you install your own copy manually?
Sure - using Debian Jessie with Mono 4.6.2.16. Wasn't aware .NET Core shipped with LibUV -tried remvoing my LibUV and using that Net Core one via the LD_LIBRARY_PATH and get the same error.
ASP.NET Core is unsupported and untested on mono. That said, I don't know why you're getting that error. If you could provide specific repro steps for your setup that would be great.
1.10.1 is a patch release but so far we have not tried running Kestrel on Libuv newer than 1.10.0.
Repro steps:
- Use any Mono version after 4.4.0 (using Docker Mono official image)
- Install LibUV from GitHub releases (or install dotnet and point your LD_LIBRARY_PATH to /usr/share/lib.... in the .NET Core installation if you have one)
- Write a simple Hello World console using the "Microsoft.AspNetCore.Server.Kestrel" nuget pakage app like so:
WebHostBuilder()
.UseUrls("http://0.0.0.0:8083")
.UseKestrel()
.Configure(fun a -> a.Run(fun c -> c.Response.WriteAsync("Hello from Plain Kestrel!")))
.Build()
.Run()
- Build and run.
I've put a repo with a Dockerfile that reproduces the issue here: https://github.com/mvkra/kestrelexperiment. Any help would be great.
@davidfowl I think you meant "Mono is unsupported and untested" 😄
Fixed 😄
Fixed 😄
@davidfowl Where can I find the fix? I've got the same problem using latest Mono, latest LibUV, and latest Microsoft.AspNetCore.Server.Kestrel
I meant, fixed my typo. Mono still isn't a platform we test on.
My temporary solution:
- Downgrade Microsoft.AspNetCore.Server.Kestrel to 1.0.3
- Remove System.Runtime.InteropServices.RuntimeInformation.dll from outputs (because of #963)
- Downgrade Microsoft.Extensions.Logging.Console to 1.0.2 (because 1.1.1 refuses to use System.Runtime.InteropServices.RuntimeInformation.dll from mono, but 1.0.2 - don't :confused:)
- It works! :relieved:
/cc @akoeplinger System.Runtime.InteropServices.RuntimeInformation is on of the main reasons things don't work on mono. Is that resolved yet?
@davidfowl we're blacklisting certain assemblies from certain nuget packages on Mono 4.8+ now because they contain Windows-specific implementation in lib/net45. System.Runtime.InteropServices.RuntimeInformation is one of those on the blacklist, more specifically from the 4.0.0.0 and 4.3.0.0 nuget packages iirc.
Of course this is still a hack and doesn't work e.g. for myget packages etc but it's the best we can do until the packages are fixed (e.g. via dotnet/corefx#15112)