fix: Fix segmentation fault in tests on CPUs with PKU support#471
Merged
mmastrac merged 4 commits intodenoland:mainfrom Jan 24, 2024
Digifox03:main
Merged
fix: Fix segmentation fault in tests on CPUs with PKU support#471mmastrac merged 4 commits intodenoland:mainfrom Digifox03:main
mmastrac merged 4 commits intodenoland:mainfrom
Digifox03:main
Conversation
mmastrac
reviewed
Jan 24, 2024
Contributor
mmastrac
left a comment
There was a problem hiding this comment.
We'll probably need to tweak the features a bit but it looks like the right approach.
Member
|
Do we need to add a Cargo feature here? Maybe we could rely on |
Contributor
I think the problem is that some downstream crates need the PKU workaround. |
This was referenced Jan 25, 2024
mmastrac
pushed a commit
to denoland/deno
that referenced
this pull request
Feb 5, 2024
This is a followup on denoland/deno_core#471. Fixes #21439.
mmastrac
pushed a commit
to mmastrac/deno
that referenced
this pull request
Feb 5, 2024
…nd#22152) This is a followup on denoland/deno_core#471. Fixes denoland#21439.
littledivy
pushed a commit
to denoland/deno
that referenced
this pull request
Feb 8, 2024
This is a followup on denoland/deno_core#471. Fixes #21439.
nathanwhit
pushed a commit
to denoland/deno
that referenced
this pull request
Jun 18, 2025
Fixes #29793. This PR reapplies #22152 (see issue for further details). Changes `deno_core` in tests to be built with the `unsafe_use_unprotected_platform` feature. The issue is caused by two or more threads (in Deno's test suite, tests are spread out across worker threads) in the same process accessing v8's isolates (see denoland/deno_core#471 for further details).
CyanChanges
pushed a commit
to CyanChanges/deno
that referenced
this pull request
Jun 23, 2025
…29794) Fixes denoland#29793. This PR reapplies denoland#22152 (see issue for further details). Changes `deno_core` in tests to be built with the `unsafe_use_unprotected_platform` feature. The issue is caused by two or more threads (in Deno's test suite, tests are spread out across worker threads) in the same process accessing v8's isolates (see denoland/deno_core#471 for further details).
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.
Due to V8's PKU feature, only the thread that initialized the V8 platform or those spawned from it can access the isolates; other threads will get a segmentation fault. Since each test runs in its thread, they crash on newer CPUs that support PKU.
This issue has two possible solutions:
This issue was already encountered for the
deno testcommand, which was resolved by initializing the platform in the main thread (denoland/deno#20495).In the case of rust tests, the same solution cannot be used, as the default test runner does not allow running code on the main thread before any test runs.
My proposed solution is to add a feature flag to deno_core, which, when enabled, uses the unprotected platform. An alternative solution could be to call
deno_core::JsRuntime::init_platformat the beginning of each test.This PR will also be a step towards fixing denoland/deno#21439