System.Net.Sockets.SocketException (0xFFFDFFFE): Unknown socket error

Dani Kurniawan 0 Reputation points
2023-11-24T10:02:24.8066667+00:00

Hi,

We started receiving this SocketExceptions after we updated the .Net version from 3.1 to 6, and restart was required to fix it.

This is an intermittent error.

Previously in the .Net Core 3.1 this error did not occur.

Configuration

  • .NET 6
  • Kubernetes in AWS EKS

The exception we are getting is :

ErrorMessage: System.Net.Http.HttpRequestException: Unknown socket error (extsvc:80)<br/> ---> System.Net.Sockets.SocketException (0xFFFDFFFE): Unknown socket error<br/>   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)<br/>   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)<br/>   at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|277_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)<br/>   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)<br/>   --- End of inner exception stack trace ---<br/>   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)<br/>   at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)<br/>   at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)<br/>   at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request)<br/>   at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)<br/>   at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)<br/>   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)<br/>   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)<br/>   at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)<br/>   at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)<br/>   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)<br/>   at Moh.Cas.Composite.ClaimProcessing.Application.Services.PRSClient.GetDoctorSpecialties(String[] smcNumbers) in /app/Moh.Cas.Composite.ClaimProcessing.Application/Services/PRSClient.cs:line 37<br/>   at Moh.Cas.Composite.ClaimProcessing.Application.Features.Claims.Commands.ClaimEntityCreateCommandHandler._GetSpecialties(String[] smcNumbers) in /app/Moh.Cas.Composite.ClaimProcessing.Application/Features/Claims/Commands/ClaimEntityCreateCommand.cs:line 109<br/>   at Moh.Cas.Composite.ClaimProcessing.Application.Features.Claims.Commands.ClaimEntityCreateCommandHandler._CreateOrDeleteDoctorSpecialties(List`1 smcNumbers) in /app/Moh.Cas.Composite.ClaimProcessing.Application/Features/Claims/Commands/ClaimEntityCreateCommand.cs:line 155<br/>   at Moh.Cas.Composite.ClaimProcessing.Application.Features.Claims.Commands.ClaimEntityCreateCommandHandler.Handle(ClaimBulkCreateRequestDto request, CancellationToken cancellationToken) in /app/Moh.Cas.Composite.ClaimProcessing.Application/Features/Claims/Commands/ClaimEntityCreateCommand.cs:line 96<br/>   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)<br/>   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)<br/>   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)<br/>   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)<br/>   at MediatR.Pipeline.RequestPostProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)<br/>   at MediatR.Pipeline.RequestPreProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)<br/>   at Moh.Cas.Composite.ClaimProcessing.Application.Validators.ValidationBehaviour`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken) in /app/Moh.Cas.Composite.ClaimProcessing.Application/Validators/ValidationBehaviour.cs:line 32<br/>   at Moh.Cas.Composite.ClaimProcessing.Events.Listeners.ClaimInboundUcfmsg2EventHandler.RunAsync(EventRequest eventRequest) in /app/Moh.Cas.Composite.ClaimProcessing/Events/Listeners/ClaimInboundUcfmsg2EventHandler.cs:line 198
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,232 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,130 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Abhiram Mangde 0 Reputation points
    2023-11-25T10:07:55.71+00:00

    The error that I believe you are encountering seems to be related to a System.Net.Sockets.SocketException that occurred after updating from .NET Core 3.1 to .NET 6 migration.

    • One possible solution that you can check is to ensure that you have reviewed the release notes for .NET 6 to identify any breaking changes or updates that might affect socket operations. There might be some packages that got depreciated or additional dependencies were added. Microsoft's official documentation usually provides details about such changes.
    • Socket Timeout Settings: Examine the timeout settings for your socket operations. There might be changes in default values or behavior that affect how sockets are handled in .NET 6. Adjusting timeout settings may help in cases of intermittent errors.
    • Provided that you're using Kubernetes in AWS EKS, check if there are any network configuration changes or restrictions introduced in your updated environment. Kubernetes networking policies or AWS security groups could impact socket communications. Since you're using AWS EKS, consider any AWS-specific changes or recommendations for networking in EKS clusters. AWS documentation and forums might provide insights into issues others may have faced in a similar environment.
    • HttpClient Behavior: The error appears to be related to an HttpRequestException. Verify if there are changes in the HttpClient behavior in .NET 6. Check your HTTP connection management, pool settings, and handling of socket errors. Hope this helps!
    0 comments No comments