Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ internal static partial class AsyncScheduler
{
private static void PlatformScheduleAction(Action a)
{
Task.Run(a);
try
{
// Wait for the task to complete to ensure that actions are executed in the correct order.
Task.Run(a).Wait();
Copy link
Member

Choose a reason for hiding this comment

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

Do we need a timeout here? Or do we already not timeout, and require the application code return in a timely manner?

Copy link
Contributor

@tanderson-ld tanderson-ld Oct 22, 2025

Choose a reason for hiding this comment

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

I think any amount of wait violates the AsyncScheduler contract, no?

Copy link
Member

Choose a reason for hiding this comment

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

True, this probably isn't good on the caller side of the equation. It still does feel like we need a thread specifically to wait for these tasks, or a pool of 1 that we just submit to.

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps a queue of tasks that get linked together as added and the next is dispatched as the previous finishes?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, that works as well, potentially very similar to the async queues we've implemented for the CSI spec.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated it to be a chained list of calls. The continueWith should still work even if an action throws an exception. This should allow us to keep the same contract but enforce the order.

}
catch (Exception)
{
// Swallow exceptions to prevent them from propagating to the caller.
}
Copy link

Choose a reason for hiding this comment

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

Bug: Silent Exception Handling Hides Critical Errors

The catch block in PlatformScheduleAction silently swallows all exceptions from scheduled actions without logging or notifying the caller. This hides potential bugs and critical errors, making debugging difficult and possibly leading to unexpected application behavior.

Fix in Cursor Fix in Web

Copy link
Member

Choose a reason for hiding this comment

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

Can we log something here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should behave similar to the existing code where we fire off a task and are not returning any values. Because we are now Waiting, there is a chance for exceptions to surface and bubble up to the caller which breaks the existing functionality.

}
}
}
Loading