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

LibUV error -14 EFAULT Bad address is system call argument #1293

Closed
mvkara opened this issue Jan 8, 2017 · 12 comments
Closed

LibUV error -14 EFAULT Bad address is system call argument #1293

mvkara opened this issue Jan 8, 2017 · 12 comments

Comments

@mvkara
Copy link

mvkara commented Jan 8, 2017

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()
@davidfowl
Copy link
Member

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?

@mvkara
Copy link
Author

mvkara commented Jan 8, 2017

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.

@davidfowl
Copy link
Member

davidfowl commented Jan 8, 2017

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.

@moozzyk
Copy link
Contributor

moozzyk commented Jan 9, 2017

1.10.1 is a patch release but so far we have not tried running Kestrel on Libuv newer than 1.10.0.

@mvkara
Copy link
Author

mvkara commented Jan 9, 2017

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.

@cesarblum
Copy link
Contributor

cesarblum commented Jan 10, 2017

@davidfowl I think you meant "Mono is unsupported and untested" 😄

@davidfowl
Copy link
Member

Fixed 😄

@muratg muratg closed this as completed Feb 3, 2017
@gisek
Copy link

gisek commented Feb 20, 2017

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

@davidfowl
Copy link
Member

I meant, fixed my typo. Mono still isn't a platform we test on.

@alex-novikov-1990
Copy link

alex-novikov-1990 commented Mar 21, 2017

My temporary solution:

  1. Downgrade Microsoft.AspNetCore.Server.Kestrel to 1.0.3
  2. Remove System.Runtime.InteropServices.RuntimeInformation.dll from outputs (because of Can't run with Linux/Mono/dotnet-cli #963)
  3. 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 😕)
  4. It works! 😌

@davidfowl
Copy link
Member

/cc @akoeplinger System.Runtime.InteropServices.RuntimeInformation is on of the main reasons things don't work on mono. Is that resolved yet?

@akoeplinger
Copy link

@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)

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

No branches or pull requests

8 participants