Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Orleans.Runtime/Catalog/StatelessWorkerGrainContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ private async Task RunMessageLoop()
// When the last worker is destroyed, we can consider the stateless worker grain
// activation to be destroyed as well
_shared.InternalRuntime.Catalog.UnregisterMessageTarget(this);
var completion = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
EnqueueWorkItem(WorkItemType.DisposeAsync, new DisposeAsyncWorkItemState(completion));

Copilot AI Aug 4, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The completion variable is created but never used or awaited. Consider either using this TaskCompletionSource to wait for disposal completion or removing it if not needed.

Suggested change
var completion = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
EnqueueWorkItem(WorkItemType.DisposeAsync, new DisposeAsyncWorkItemState(completion));
EnqueueWorkItem(WorkItemType.DisposeAsync, new DisposeAsyncWorkItemState(null));

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither is correct, for one the DisposeAsyncWorkItemState expects a non-null TCS, and awaiting the tcs.Task would deadlock the loop. Eitherway I hooked a continuation to at least log any potential errors that might occur in the dispose internal method.

}
break;
}
Expand Down
Loading