Skip to content

Egress operations can silently fail #6684

Open
@schmittjoseph

Description

@schmittjoseph

Description

If an operation encounters an error (and enters the Faulted state) it should log an error message.

However there's an issue that can cause the operation to silently fail (never logging the error), this occurs when:

  • An egress provider is used for the operation
  • The exception thrown by the operation isn't one of the following: ArgumentException, DiagnosticsClientException, InvalidOperationException, OperationCanceledException, MonitoringException, ValidationException, UnauthorizedAccessException

This is due to us incorrectly re-using ActionContextExtensions.InvokeAsync for egress operations, which does filtering on the exception thrown of an arbitrary action to determine if it should be logged or not:

try
{
return await action(token);
}
catch (ArgumentException ex) when (LogError(logger, ex))
{
return ExecutionResult<T>.Failed(ex);
}
catch (DiagnosticsClientException ex) when (LogError(logger, ex))
{
return ExecutionResult<T>.Failed(ex);
}
catch (InvalidOperationException ex) when (LogError(logger, ex))
{
return ExecutionResult<T>.Failed(ex);
}
catch (OperationCanceledException ex) when (token.IsCancellationRequested && LogInformation(logger, ex))
{
return ExecutionResult<T>.Failed(ex);
}
catch (OperationCanceledException ex) when (LogError(logger, ex))
{
return ExecutionResult<T>.Failed(ex);
}
catch (MonitoringException ex) when (LogError(logger, ex))
{
return ExecutionResult<T>.Failed(ex);
}
catch (ValidationException ex) when (LogError(logger, ex))
{
return ExecutionResult<T>.Failed(ex);
}
catch (UnauthorizedAccessException ex) when (LogError(logger, ex))
{
return ExecutionResult<T>.Failed(ex);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions