Skip to content

InvalidProgramException with message "JIT Compiler encountered an internal limitation." thrown during HTTP calls #12812

@martincostello

Description

@martincostello

This morning when a new EC2 instance was launched for an ASP.NET Core 2.2.5 application of ours in a production environment, all outbound HTTP requests to dependent services failed with the following exception:

System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.IO.IOException: Unable to write data to the transport connection: JIT Compiler encountered an internal limitation.. ---> System.InvalidProgramException: JIT Compiler encountered an internal limitation.
   at T System.Threading.LazyInitializer.EnsureInitialized<T>(ref T target)
   at ValueTask System.Net.Sockets.Socket.SendAsyncForNetworkStream(ReadOnlyMemory<byte> buffer, SocketFlags socketFlags, CancellationToken cancellationToken)
   at ValueTask System.Net.Sockets.NetworkStream.WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at ValueTask System.Net.Sockets.NetworkStream.WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken)
   at ValueTask System.Net.Http.HttpConnection.WriteToStreamAsync(ReadOnlyMemory<byte> source)
   at ValueTask System.Net.Http.HttpConnection.FlushAsync()
   at async Task<HttpResponseMessage> System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at async Task<HttpResponseMessage> System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
   at async Task<HttpResponseMessage> System.Net.Http.HttpConnectionPool.SendWithNtConnectionAuthAsync(HttpConnection connection, HttpRequestMessage request, bool doRequestAuth, CancellationToken cancellationToken)
   at async Task<HttpResponseMessage> System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, bool doRequestAuth, CancellationToken cancellationToken)
   at async Task<HttpResponseMessage> System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at async Task<HttpResponseMessage> System.Net.Http.DecompressionHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at async Task<HttpResponseMessage> Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
<snip>

The inner-most exception appears to indicate a JIT issue.

This is the first time we've ever seen this issue, but it seemed to be unrecoverable. Exceptions were thrown for all HTTP requests made by the application until it was removed from our application load balancer and stopped receiving user traffic.

We've captured two full dumps of the dotnet.exe from the instance before it was terminated which we can share with your privately if it helps diagnose the issue.

Let me know if there's any further information I can share with you other than the dump files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions