-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
vm.compileFunction is crashing the node process with unknown error #27256
Comments
This seems to have been fixed between v11.10.1 and v11.11.0, so it’s probably just a question of figuring out the bugfix and backporting it. I’ll try to bisect. |
I am curious to see the reason behind this. If you find the fix, can you please post a reference here? |
Ok, so, there are two issues here: The crash is being addressed by 7b19893; in particular, 7b19893#diff-0cf206672499c2f86db4ffb0cc5b668bL1101 would previously have crashed, because there was no exception caught by the However, this does not actually work on newer released versions of Node.js, it just returns |
Okay, digging a bit more: Until v8/v8@61f4c22, V8 assumed that the argument name string was not internally represented as a concatenated string. Apparently, V8 has a cutoff value here that decides whether the result of your string concatenation is internally represented as a contiguous block of memory, or as the concatenation of two or more contiguous blocks of memory. The “is this a valid identifier” check would simply fail in the latter case. This is fixed by the linked V8 commit. It’s also not ideal that V8 doesn’t throw an exception in this case, which imo it should when returning an empty |
The differences to the original patch are the replacement of `i::IsIdentifier...()` with `unicode_cache_.IsIdentifier...()`, because the former is not available on Node.js v11.x, as well as the omitted `no_gc` argument for `GetFlatContent()`. Original commit message: Assume flat string when checking CompileFunctionInContext arguments. [email protected] Change-Id: I54c6137a3c6e14d4102188f154aa7216e7414dbc Reviewed-on: https://chromium-review.googlesource.com/c/1388533 Reviewed-by: Jakob Kummerow <[email protected]> Commit-Queue: Yang Guo <[email protected]> Cr-Commit-Position: refs/heads/master@{#58562} Refs: v8/v8@61f4c22 Fixes: nodejs#27256
#27259 should address the main issue here for v11.x, and could be backported to v10.x. |
Yes. I think that it should throw an exception indeed, similar to other compile APIs. |
The differences to the original patch are the replacement of `i::IsIdentifier...()` with `unicode_cache_.IsIdentifier...()`, because the former is not available on Node.js v11.x, as well as the omitted `no_gc` argument for `GetFlatContent()`. Original commit message: Assume flat string when checking CompileFunctionInContext arguments. [email protected] Change-Id: I54c6137a3c6e14d4102188f154aa7216e7414dbc Reviewed-on: https://chromium-review.googlesource.com/c/1388533 Reviewed-by: Jakob Kummerow <[email protected]> Commit-Queue: Yang Guo <[email protected]> Cr-Commit-Position: refs/heads/master@{#58562} Refs: v8/v8@61f4c22 Fixes: #27256 PR-URL: #27259 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Shelley Vohr <[email protected]>
I'll proceed to close this issue, this seems to be fixed on Fermiun (LTS), and Dubnium is sadly no longer maintained. |
The following simple script crashes the node process with no apparent reason:
Output:
The text was updated successfully, but these errors were encountered: