Repository navigation
Conversation
…deadline deno_core converted application-controlled values into JsError, and that conversion could abort the process or run forever: - A thrown error's errorAdditionalPropertyKeys array sized a Vec, so a huge length aborted. - The conversion cancelled termination and then ran getters, so a looping message, name or cause getter outlived the deadline. Its fresh "execution terminated" error inherited both problems from Error.prototype. Application errors now reach the host only through op_chunk_report, which formats them from V8's message and captured frames without running JavaScript. Bootstrap installs it as the report-exception and unhandled-rejection hooks and catches every invocation's error. Every termination, whether from the report, the deadline, cancellation or the heap limit, first dispatches undefined, so deno_core only ever converts that. The watchdog keeps interrupting a terminated run until it ends, since deno_core cancels termination while converting. Refs #300.
…error describe converted whole message, function and script strings into Rust before truncating, so a multi-megabyte message was copied in full and kept its capacity. Each string now copies at most the remaining byte budget, and frames stop once it is used. Adds tests that a failed invocation leaves nothing for the next call, and that reading error.stack in a function that then hits its deadline still ends on time. Refs #300
…ing its runtime A rejection created in a microtask of a failed transaction invocation stayed pending and failed the next call on the retained runtime. The failed call now drains its event loop under the deadline guard, keeping its first reported error, and skips the drain once a termination has been recorded since that runtime is discarded. Refs #300
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #300. #341 left two ways for application JavaScript to take down core while it converts a thrown error. Throwing an error whose
errorAdditionalPropertyKeysis a huge array still aborted the process. An error with a loopingmessagegetter still kept running past the invocation deadline. Both happened because deno_core converts thrown values by running their JavaScript.Now chunk-js formats every application error itself, and no application JavaScript runs while it does:
queueMicrotaskerrors, unhandled rejections and top-level module errors all go through one op. It reads only V8's own message and captured frames, and copies at most 16 KiB out of V8 in total.undefinedbefore terminating, so deno_core only ever convertsundefined. The watchdog and heap callback do this through a V8 interrupt insrc/isolate.rs.Behaviour changes
Checks
cargo test -p chunk-js: 32 passed, plus the compile-fail doctest.cargo clippy -p chunk-js --all-targets -- -D warningsandcargo fmt -p chunk-js --checkare clean.🤖 Generated with Claude Code