Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Egress operations can silently fail #6684

Open
schmittjoseph opened this issue May 20, 2024 · 0 comments
Open

Egress operations can silently fail #6684

schmittjoseph opened this issue May 20, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@schmittjoseph
Copy link
Member

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);
}

@schmittjoseph schmittjoseph added the bug Something isn't working label May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant