GH-49995: [R][Wasm] Fix threading issue under Wasm/Emscripten#49996
GH-49995: [R][Wasm] Fix threading issue under Wasm/Emscripten#49996amoeba wants to merge 10 commits into
Conversation
|
@github-actions crossbow submit test-r-wasm |
|
Revision: dadf0f5 Submitted crossbow builds: ursacomputing/crossbow @ actions-9b0263bfa9
|
|
@github-actions crossbow submit test-r-wasm |
|
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
|
|
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/ |
| 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 |
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?
There was a problem hiding this comment.
It looks like maybe we can at least run some R code in the container if not run the test suite. I'll report back.
|
@github-actions crossbow submit test-r-wasm |
|
I'm testing trying to install, load the package, and run the test suite in CI here. I tried testing locally but I'm running into what appears to be some qemu errors since I'm running Docker on Mac so we'll see how this runs in CI. |
|
Revision: 19efaf3 Submitted crossbow builds: ursacomputing/crossbow @ actions-6a9811d919
|
|
@github-actions crossbow submit test-r-wasm |
|
Revision: 47738fa Submitted crossbow builds: ursacomputing/crossbow @ actions-8e088c6ac8
|
|
The job runs but we don't actually run any tests, More soon! |
|
@github-actions crossbow submit test-r-wasm |
|
Revision: 9f03a2a Submitted crossbow builds: ursacomputing/crossbow @ actions-d71cf926ef
|
|
I couldn't find any examples of people running their test suites under Wasm but I'm going to see if I can't get it working in 9f03a2a. If that doesn't work easily, I think it'd be good enough to just write a simple test script to run instead. |
|
That went shockingly well,
Here are the errors/failures: |
|
@github-actions crossbow submit test-r-wasm |
|
Revision: 80a2fb1 Submitted crossbow builds: ursacomputing/crossbow @ actions-a3bfe97816
|
|
@github-actions crossbow submit test-r-wasm |
|
Revision: b8810d9 Submitted crossbow builds: ursacomputing/crossbow @ actions-1810f2dac4
|
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.