-
Notifications
You must be signed in to change notification settings - Fork 270
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
Playground not loading on Android and Chrome #564
Comments
Could you tell us which browser you're using, in case it might be relevant? |
I am using Google Chrome @eliot-akira |
@sumitsinghwp I'm seeing the same thing, and I've let it load for near ten minutes. I don't have the console output, so I'm not sure what's going on. Any chance you can get a copy of the output logging and share? or anyone? I think one needs to connect to Android Studio or download some Dev Tools app to do this. On Firefox on Android it's loading fine, so definitely not a network issue. |
@ellatrix it looks like the Blocknotes issue you're experiencing too! Playground should be better about communication problems and at least say "network error, click here to retry" and output some useful info in devtools (if it doesn't already) |
This is the code fragment at fault whenever the progress bar gets stuck at 50%: wordpress-playground/packages/playground/client/src/index.ts Lines 109 to 120 in e28db3b
I know that, because
This can be somewhat seen here: wordpress-playground/packages/playground/client/src/index.ts Lines 74 to 86 in e28db3b
I believe this await playground.isReady(); I think I saw the progress bar slowly moving forward for a tiny bit, which would suggest the first Blueprint step attempts to run: wordpress-playground/packages/playground/blueprints/src/lib/compile.ts Lines 260 to 274 in e28db3b
But, again a guess, it throws an error and never finishes. It would be lovely to display these errors in the UI to at least tell the user what's going on. As to why – I'm not sure yet. I've seen this happening when a cached There is a slight chance that #561 solved this issue. We'll know for sure once new playground.wordpress.net is deployed – perhaps tomorrow |
Well it can't be a Blueprint error because those would advance the progress bar to completion (whether that behavior makes sense is a separate discussion): wordpress-playground/packages/playground/blueprints/src/lib/compile.ts Lines 113 to 142 in 3d78688
It can't be wordpress-playground/packages/php-wasm/web/src/lib/api.ts Lines 38 to 57 in 3d78688
Therefore, it's either The web worker doesn't report it's ready, and that would happen when it cannot load PHP or WordPresswordpress-playground/packages/playground/remote/src/lib/worker-thread.ts Lines 137 to 175 in 3d78688
The service worker is not getting registeredwordpress-playground/packages/playground/remote/src/lib/boot-playground-remote.ts Lines 148 to 159 in 3d78688
Either way, |
@adamziel this is Chrome-specific on Android. there's probably a clue in there. |
I'm exploring better error reporting in #570, this should give us more answers |
Improve the UX at #564 by bubbling up errors encountered when initializing workers. This PR is meant to display an error message whenever there's a problem downloading any of the assets required to run the Playground including: * .wasm files * .data files * Dynamic JavaScript imports * Web worker * Service worker Co-authored-by: Dennis Snell <dennis.snell@automattic.com>
Improve the UX at WordPress/wordpress-playground#564 by bubbling up errors encountered when initializing workers. This PR is meant to display an error message whenever there's a problem downloading any of the assets required to run the Playground including: * .wasm files * .data files * Dynamic JavaScript imports * Web worker * Service worker Co-authored-by: Dennis Snell <dennis.snell@automattic.com>
Does this work for you now by any chance, @sumitsinghwp? I wonder if any of the changes made in the meantime helped at all. |
I'm closing this issue as I could not reproduce the problem on multiple Android browsers at browserstack. Feel free to comment if the problem pops up again @sumitsinghwp! Brownie points if you could provide the output from developer tools. Here's what I saw in my testing: Chrome on Pixel 7 (Android 12): Chrome on Pixel 8 Pro (Android 13): Galaxy S23 (Android 13): Galaxy S22 Plus (Android 12): Galaxy S21 (Android 11): |
The problem here is specific to |
Makes the WordPress data module reject the loading promise on XHR error. Before this commit, the promise would erroneously resolve even if the request failed. Related to #564
Makes the WordPress data module reject the loading promise on XHR error. Before this commit, the promise would erroneously resolve even if the request failed. Related to #564 ## Testing Instructions Rebuild the WordPress data module as follows: ```bash node packages/playground/wordpress/build/build.js --wp-version=latest --output-js=packages/playground/wordpress/src/wordpress --output-assets=packages/playground/wordpress/public ``` Then make the following update to the `wp-6.4.js` file: ```js // import dependencyFilename from './wp-6.4.data?url'; const dependencyFilename = 'http://localhost:3000/assets/wp-6.4-1d0e58cc.data'; export { dependencyFilename }; ``` Then create a new file called `server.js` with the following contents: ```js // Serve static assets from dist/packages/playground/wasm-wordpress-net/, but // break the connection when the file is 90% downloaded const express = require('express'); const app = express(); const path = require('path'); const fs = require('fs'); const port = 3000; app.get('/*', (req, res) => { const filePath = path.join( __dirname, 'dist/packages/playground/wasm-wordpress-net/' + (req.query.path || 'index.html') ); const stat = fs.statSync(filePath); const fileSize = stat.size; const head = { 'Content-Length': fileSize, 'Content-Type': 'application/wasm', 'Access-Control-Allow-Origin': '*', }; res.writeHead(200, head); let sentSoFar = 0; const stream = fs.createReadStream(filePath); stream.on('data', (chunk) => { if (sentSoFar + chunk.length > fileSize * 0.9) { stream.destroy(); res.end(); return; } res.write(chunk); sentSoFar += chunk.length; }); }); app.listen(port, () => console.log(`Example app listening on port ${port}!`)); ``` Then run `node server.js` and `npm run dev` and go to http://localhost:5400/website-server/ You'll land in a version of Playground where only the first ~90% of the WordPress data module is downloaded and then the connection is cut. You should see the "oops, WordPress Playground had a hiccup" error message.
Playground used the Emscripten's filepacker.py tool to bundle WordPress releases as zip files. This caused a lot of problems: * Filepacker splits WordPress into a `.data` file, with all the bytes concatenated as a single blob, and a `.js` file with the map of offsets and lengths for each file. Sometimes the browsers would invalidate the cache for the `.data` file, but not the `.js` file, causing the playground to fail to load. * The `.js` files had to be patched in the Dockerfile. * The `.js` files used XHR to load the `.data` files, which required custom error handling logic, progress monitoring logic, and even then some of the errors were not handled properly – see #564. * The `.data` loading code required custom loading logic. * The `.data` files were not stream–loaded. This PR doesn't stream-load the `.zip` files either, but that feature may be added in the future using the new `@wp-playground/compression-streams` package. ## Changes * The WordPress build process now produces `.zip` files instead of `.data` + `.js` files. * The worker thread now loads WordPress from zip files, including zips from arbitrary URLs. * Query API and Blueprints now accept URLs via the `?wp=` parameter. ## Testing instructions * Confirm all the E2E tests pass cc @bgrgicak
This should be fixed by #978. Any WordPress loading errors will now be clearly surfaced. |
Hey,
I have tried to test playground in my mobile and it's loading countinue. I am using android OS.
Also when try to change php version in pop-up then still not able to change.
More information see record video.
Screenrecorder-2023-06-18-08-59-02-608.mp4
The text was updated successfully, but these errors were encountered: