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

Orchestrator fails to correctly log unhandled exceptions from an activity function when message contains the sequence: colon space #3024

Open
iansall opened this issue Feb 1, 2025 · 0 comments

Comments

@iansall
Copy link

iansall commented Feb 1, 2025

Description

I have a basic orchestration with an activity that throws an exception. The exception is not caught anywhere in user code and is allowed to cause the orchestration to fail.
If the exception message is "pre-colon: post-colon" (note the space character immediately after the colon), what gets logged is "post-colon" only - i.e. the first part of the message is not logged or stored back into the hub's table storage.
The type of exception thrown doesn't seem to matter e.g. InvalidOperationException or a custom exception.
The bug only seems to occur when the exception message contains a colon followed immediately by one or more spaces.
The problem occurs when running locally and when deployed in Azure.

Expected behavior

The exception message is logged in its entirety (in both app insights and the task hub).

Actual behavior

The part of the message preceding (and including) the colon is missing in both app insights and the task hub.

Relevant source code snippets

public class LoadActivity
{
    [Function(nameof(LoadActivity))]
    public async Task<LoadActivityResponse> Run(
        [ActivityTrigger] LoadActivityRequest request,
        FunctionContext functionContext)
    {
        throw new InvalidOperationException("Pre-colon: Post-colon");
    }
}

Known workarounds

  • I have to remove any colons from my exception messages, or, remove any spaces immediately after a colon.
  • Set EnableUserCodeException = false in HostBuilder.ConfigureFunctionsWorkerDefaults (even though this is now deprecated)
    • Note that setting this to false also seems to fix an activity retry issue to do with populating the correct values for the RetryContext.LastFailure property in the AsyncRetryHandler.

App Details

TargetFramework: net8.0 (isolated worker model)
AzureFunctionsVersion: v4

Problematic packages:
Microsoft.Azure.Functions.Worker: 2.0.0
Microsoft.Azure.Functions.Worker.Extensions.DurableTask: 1.2.2
Microsoft.Azure.Functions.Worker.Extensions.EventGrid: 3.4.2
Microsoft.Azure.Functions.Worker.Extensions.Http: 3.2.0
Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs: 6.6.0
Microsoft.Azure.Functions.Worker.Extensions.Tables: 1.4.2
Microsoft.Azure.Functions.Worker.Sdk: 2.0.0
Microsoft.Azure.Functions.Worker.ApplicationInsights: 2.0.0

The bug has appeared since upgrading from the following packages:
Microsoft.Azure.Functions.Worker: 1.22.0
Microsoft.Azure.Functions.Worker.Extensions.DurableTask: 1.1.4
Microsoft.Azure.Functions.Worker.Extensions.EventGrid: 3.4.2
Microsoft.Azure.Functions.Worker.Extensions.Http: 3.2.0
Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs: 6.4.0
Microsoft.Azure.Functions.Worker.Extensions.Tables: 1.4.2
Microsoft.Azure.Functions.Worker.Sdk: 1.17.2
Microsoft.Azure.Functions.Worker.ApplicationInsights: 1.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant