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

fix(workflow): Clearly diffentiate WFT failures resulting from unhandle Promise rejection #1606

Merged
merged 9 commits into from
Feb 27, 2025

Conversation

mjameswh
Copy link
Contributor

@mjameswh mjameswh commented Jan 17, 2025

What changed

  • The sandbox was previously converting all non-TemporalFailure errors thrown while processing a Workflow Activation into unhandled promise rejections, to be caught elsewhere. This was done intentionally and technically worked correctly most of the time, but made it impossible to differentiate errors that were indeed uncaught promise rejections, occasionally resulting in hard to diagnose errors (see [Bug] Unhandled promise rejections results in hard to diagnose WFT failure #1039). It also resulted in some incorrect behaviors in uncommon/rare use cases.

    This PR introduces a cleaner way to propagate non-TemporalFailures errors up, thus avoiding the intentional use of Unhandled Promise Rejection for that purpose.

    Also, errors resulting from actual unhandled promise rejections now get wrapped in a UnhandledRejectionError, making this fact clear in error messages that are reported in logs, Workflow History, and UI.

Fixes #1039.

@mjameswh mjameswh force-pushed the unhandled-promise-rejections branch from c028018 to 8cc294e Compare January 24, 2025 19:34
@mjameswh mjameswh marked this pull request as ready for review January 24, 2025 21:03
@mjameswh mjameswh requested a review from a team as a code owner January 24, 2025 21:03
Copy link
Member

@bergundy bergundy left a comment

Choose a reason for hiding this comment

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

Leaving it up to you to make a call here. Functionally I don't see a problem with this code.

Copy link
Contributor

@THardy98 THardy98 left a comment

Choose a reason for hiding this comment

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

Left a couple comments, nothing blocking

@mjameswh mjameswh merged commit eb67d04 into temporalio:main Feb 27, 2025
22 checks passed
@mjameswh mjameswh deleted the unhandled-promise-rejections branch February 27, 2025 23:00
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

Successfully merging this pull request may close these issues.

[Bug] Unhandled promise rejections results in hard to diagnose WFT failure
3 participants