-
Notifications
You must be signed in to change notification settings - Fork 525
Do not propagate exception inside HTMLRewriter parser #5976
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
base: main
Are you sure you want to change the base?
Conversation
| ioContext.addTask( | ||
| ioContext | ||
| .waitForDeferredProxy(KJ_ASSERT_NONNULL(maybeInput)->pumpTo(js, kj::mv(rewriter), true)) | ||
| .catch_([](kj::Exception&& e) { | ||
| // Errors in pumpTo() are already propagated to the destination stream. We don't want to | ||
| // throw them from here since it'll cause an uncaught exception to be reported via taskFailed(), | ||
| // which would poison the IoContext even though the application may have handled the error. | ||
| })); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is copied from "ReadableStream::serialize"
workerd/src/workerd/api/streams/readable.c++
Lines 857 to 862 in 754045d
| ioctx.addTask( | |
| ioctx.waitForDeferredProxy(pumpTo(js, kj::mv(sink), true)).catch_([](kj::Exception&& e) { | |
| // Errors in pumpTo() are automatically propagated to the source and destination. We don't | |
| // want to throw them from here since it'll cause an uncaught exception to be reported, even | |
| // if the application actually does handle it! | |
| })); |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5976 +/- ##
==========================================
- Coverage 70.17% 70.17% -0.01%
==========================================
Files 407 407
Lines 107238 107241 +3
Branches 17985 17985
==========================================
+ Hits 75253 75255 +2
- Misses 21195 21196 +1
Partials 10790 10790 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
b5b3a4a to
bd2e85b
Compare
CodSpeed Performance ReportMerging this PR will improve performance by 13.08%Comparing Summary
Performance Changes
Footnotes
|
dom96
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this have any impact on existing code in prod? i.e. do we need to do this behind a new compat flag?
|
@dom96 it should not have a negative impact. This is undoing part of another recent change that landed within the past two weeks. |
bd2e85b to
ccb8ecd
Compare
When an exception is threw inside HTMLRewriter handler, that error marks the task as failure and make subsequent transforms fail. This PR changes it to catch the exception so it is not propagated other than the stream.