GH-49995: [R][Wasm] Fix threading issue under Wasm/Emscripten#49996
Open
amoeba wants to merge 3 commits into
Open
GH-49995: [R][Wasm] Fix threading issue under Wasm/Emscripten#49996amoeba wants to merge 3 commits into
amoeba wants to merge 3 commits into
Conversation
Member
Author
|
@github-actions crossbow submit test-r-wasm |
|
Revision: dadf0f5 Submitted crossbow builds: ursacomputing/crossbow @ actions-9b0263bfa9
|
Member
Author
|
@github-actions crossbow submit test-r-wasm |
Member
Author
|
With dadf0f5, Parquet reading works with my local test. I'm testing the changes separately so I know what's actually fixing things here. |
|
Revision: abaacb8 Submitted crossbow builds: ursacomputing/crossbow @ actions-510511a107
|
Member
Author
|
I marked this as ready for review. The PR description hopefully explains all that's needed and I put together a demo at https://amoeba.github.io/arrow-r-wasm/ |
jonkeane
reviewed
May 20, 2026
Comment on lines
+48
to
+56
| bool CanRunWithCapturedR() { | ||
| #ifdef __EMSCRIPTEN__ | ||
| // Threading is not supported under Emscripten/WASM. Always take the | ||
| // synchronous path to avoid attempting pthread_create which will fail | ||
| // with "thread constructor failed: Not supported". | ||
| return false; | ||
| #else | ||
| return MainRThread::GetInstance().Executor() == nullptr; | ||
| #endif |
Member
There was a problem hiding this comment.
Is it possible to add a test (or maybe it's that we actually need to run the tests under wasm(???) to catch this?
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.
Rationale for this change
#49982 added a basic Wasm build but after doing some testing I ran into an issue with threading.
What changes are included in this PR?
CanRunWithCapturedRso it's always false under Emscripten. This change is the only change that was strictly needed to fix my issue. I'm not a pro with this part of the codebase so scrutiny welcome.options(arrow.use_threads = FALSE)when running under Wasm just in case since it makes sense to not use threads in a Wasm contextAre these changes tested?
Yes. Crossbow jobs show the build works and I have a demo at https://amoeba.github.io/arrow-r-wasm/.
Are there any user-facing changes?
No.