Skip to content

DefaultExceptionSerializationStrategy throws System.NullReferenceException #252

@kvattikuti

Description

@kvattikuti

AWSSDK.XRay Version="3.7.0.29"
AWSXRayRecorder.Handlers.AwsSdk Version="2.8.3"

NullReferenceException: Exception: Object reference not set to an instance of an object.
at Amazon.XRay.Recorder.Core.Strategies.DefaultExceptionSerializationStrategy.<>c__DisplayClass14_0.<DescribeException>b__3(ExceptionDescriptor d)
at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at Amazon.XRay.Recorder.Core.Strategies.DefaultExceptionSerializationStrategy.DescribeException(Exception e, IEnumerable`1 subsegments)
at Amazon.XRay.Recorder.Core.Internal.Entities.Entity.AddException(Exception e)
at Amazon.XRay.Recorder.Core.AWSXRayRecorderImpl.AddException(Exception ex)
at Ecova.DaaS.Aws.LambdaEntryPoints.HttpApi.HttpRestApiLogger.AddXrayAnnotations(IAWSXRayRecorder xrayRecorder, ApiGatewayProxyRequestWrapper requestWrapper, RequestAnnotations requestAnnotations, String partyMemberIdentifier, String awsRequestId, String correlationId, Exception exception, String errorString) in /src/Aws/Ecova.DaaS.Aws.LambdaEntryPoints/HttpApi/HttpRestApiLogger.cs:line 103
at Ecova.DaaS.Aws.LambdaEntryPoints.HttpApi.HttpRestApiLogger.LogResponse(ILogger logger, IAWSXRayRecorder xrayRecorder, ApiGatewayProxyRequestWrapper requestWrapper, String partyMemberIdentifier, RequestAnnotations requestAnnotations, Int32 httpStatusCode, Int64 timeTakenToCompleteRequest, String awsRequestId, String correlationId, Exception exception, String responseBody) in /src/Aws/Ecova.DaaS.Aws.LambdaEntryPoints/HttpApi/HttpRestApiLogger.cs:line 52
at Ecova.DaaS.Aws.LambdaEntryPoints.HttpApi.HttpRestApi.FunctionHandler(APIGatewayProxyRequest request, ILambdaContext context) in /src/Aws/Ecova.DaaS.Aws.LambdaEntryPoints/HttpApi/HttpRestApi.cs:line 145

This happens when we IAWSXRayRecorder.AddException() to X-ray recorder. It happens intermittently.

Not sure how much of help this is but here is the stacktrace of the exception we are trying to add:


Exception: 1 validation error detected: Value at 'records.1.member.data' failed to satisfy constraint: Member must have length less than or equal to 1048576
at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleExceptionStream(IRequestContext requestContext, IWebResponseData httpErrorResponse, HttpErrorResponseException exception, Stream responseStream)
at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleExceptionAsync(IExecutionContext executionContext, HttpErrorResponseException exception)
at Amazon.Runtime.Internal.ExceptionHandler`1.HandleAsync(IExecutionContext executionContext, Exception exception)
at Amazon.Runtime.Internal.ErrorHandler.ProcessExceptionAsync(IExecutionContext executionContext, Exception exception)
at Amazon.Runtime.Internal.ErrorHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.CredentialsRetriever.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.XRay.Recorder.Handlers.AwsSdk.Internal.XRayPipelineHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.MetricsHandler.InvokeAsync[T](IExecutionContext executionContext)
at Ecova.DaaS.DependencyInjection.Aws.Implementations.KinesisBatchSender`1.SendBatchHelperInner(List`1 requests) in /src/Aws/Ecova.DaaS.DependencyInjection.Aws/Implementations/KinesisBatchSender.cs:line 202
at Ecova.DaaS.DependencyInjection.Aws.Implementations.KinesisBatchSender`1.<>c__DisplayClass22_0.<<SendBatchHelper>b__0>d.MoveNext() in /src/Aws/Ecova.DaaS.DependencyInjection.Aws/Implementations/KinesisBatchSender.cs:line 174
--- End of stack trace from previous location where exception was thrown ---
at Polly.AsyncPolicy.<>c__DisplayClass40_0.<<ImplementationAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Polly.Retry.AsyncRetryEngine.ImplementationAsync[TResult](Func`3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates`1 shouldRetryResultPredicates, Func`5 onRetryAsync, Int32 permittedRetryCount, IEnumerable`1 sleepDurationsEnumerable, Func`4 sleepDurationProvider, Boolean continueOnCapturedContext)
Inner-Exception: Exception of type 'Amazon.Runtime.Internal.HttpErrorResponseException' was thrown.
at Amazon.Runtime.HttpWebRequestMessage.GetResponseAsync(CancellationToken cancellationToken)
at Amazon.Runtime.Internal.HttpHandler`1.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.Unmarshaller.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.ErrorHandler.InvokeAsync[T](IExecutionContext executionContext)

See related issue #96 which was closed without fixing it because of inactivity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions