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

System.NotSupportedException is thrown during task execution when a timer created with non UTC DateTime originally (v2.0.0-rcX). #1127

Open
ivaliyivanov opened this issue Jul 8, 2024 · 0 comments

Comments

@ivaliyivanov
Copy link

We had a timer which was created with non UTC DateTime format:

await context.CreateTimer(allocationResult.NextProjectedChange.Value.DateTime, null);

it used to be working with pre 2.0.0 DTF version but now it throws an exception, later in stack, after the timer is created and when a task is picked up for execution:

message": TaskOrchestrationDispatcher-b16f0d531284437aa1371a4493157b75-0: Unhandled exception with work item '22d6a199b42b4ab2ba41c4fc69ac7071:1': System.NotSupportedException: DateTime 06/26/2024 22:55:07 has a Kind of Unspecified. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.
at Azure.Core.TypeFormatters.ToString(DateTime value, String format)
at Azure.Core.Utf8JsonWriterExtensions.WriteObjectValue(Utf8JsonWriter writer, Object value)
at Azure.Data.Tables.TableRestClient.CreateUpdateEntityRequest(String table, String partitionKey, String rowKey, Nullable1 timeout, String ifMatch, IDictionary2 tableEntityProperties, QueryOptions queryOptions)
at Azure.Data.Tables.TableClient.CreateUpdateOrMergeRequest(TableRestClient batchOperations, ITableEntity entity, TableUpdateMode mode, ETag ifMatch)
at Azure.Data.Tables.TableClient.BuildChangeSet(TableRestClient batchOperations, IEnumerable1 batch, Dictionary2 requestLookup, Guid batchId, Guid changesetId)
at Azure.Data.Tables.TableClient.SubmitTransactionInternalAsync(IEnumerable1 transactionalBatch, Guid batchId, Guid changesetId, Boolean async, CancellationToken cancellationToken) at Azure.Data.Tables.TableClient.SubmitTransactionAsync(IEnumerable1 transactionActions, CancellationToken cancellationToken)
at DurableTask.AzureStorage.Storage.ClientResponseExtensions.DecorateFailure[T](Task1 responseTask) in /_/src/DurableTask.AzureStorage/Storage/ClientResponseExtensions.cs:line 48 at DurableTask.AzureStorage.Storage.Table.ExecuteBatchAsync(IEnumerable1 batchOperation, CancellationToken cancellationToken) in //src/DurableTask.AzureStorage/Storage/Table.cs:line 174
at DurableTask.AzureStorage.Tracking.AzureTableTrackingStore.UploadHistoryBatch(String instanceId, String sanitizedInstanceId, String executionId, IList1 historyEventBatch, StringBuilder historyEventNamesBuffer, Int32 numberOfTotalEvents, Int32 episodeNumber, Int32 estimatedBatchSizeInBytes, Nullable1 eTagValue, Boolean isFinalBatch, CancellationToken cancellationToken) in /
/src/DurableTask.AzureStorage/Tracking/AzureTableTrackingStore.cs:line 1193
at DurableTask.AzureStorage.Tracking.AzureTableTrackingStore.UpdateStateAsync(OrchestrationRuntimeState newRuntimeState, OrchestrationRuntimeState oldRuntimeState, String instanceId, String executionId, Nullable1 eTagValue, Object trackingStoreContext, CancellationToken cancellationToken) in /_/src/DurableTask.AzureStorage/Tracking/AzureTableTrackingStore.cs:line 972 at DurableTask.AzureStorage.AzureStorageOrchestrationService.CompleteTaskOrchestrationWorkItemAsync(TaskOrchestrationWorkItem workItem, OrchestrationRuntimeState newOrchestrationRuntimeState, IList1 outboundMessages, IList1 orchestratorMessages, IList1 timerMessages, TaskMessage continuedAsNewMessage, OrchestrationState orchestrationState) in //src/DurableTask.AzureStorage/AzureStorageOrchestrationService.cs:line 1218
at DurableTask.Core.TaskOrchestrationDispatcher.OnProcessWorkItemAsync(TaskOrchestrationWorkItem workItem) in /
/src/DurableTask.Core/TaskOrchestrationDispatcher.cs:line 612
at DurableTask.Core.TaskOrchestrationDispatcher.OnProcessWorkItemSessionAsync(TaskOrchestrationWorkItem workItem) in //src/DurableTask.Core/TaskOrchestrationDispatcher.cs:line 211
at DurableTask.Core.WorkItemDispatcher`1.ProcessWorkItemAsync(WorkItemDispatcherContext context, Object workItemObj) in /
/src/DurableTask.Core/WorkItemDispatcher.cs:line 459

While it might be considered not correct usage of the CreateTimer method it is still a breaking change, and the stack trace doesn't point to a correct place where the actual issue is. It would be helpful to add some check during a timer creation and throw an exception when a non-UTC date time provided.

@ivaliyivanov ivaliyivanov changed the title System.NotSupportedException is thrown during task execution when a timer created with non UTC DateTime originally. System.NotSupportedException is thrown during task execution when a timer created with non UTC DateTime originally (v2.0.0-rcX). Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant