Closed skorfmann closed 11 months ago
There seems to be a 4GB memory limit for WASM in Chrome https://chat.openai.com/share/eae464a8-ecdd-4fd9-abca-6ba55916f626 (which is confirmed by https://v8.dev/blog/4gb-wasm-memory). However, this is per WASM instance according to ChatGPT, not sure how trustworthy that info is though 😆
@ekeren let's priorities
@eladcon , as we use the playground more, it is becoming an issue.
can you take a look?
It happens to me on the forth tab
seems like this is a websontainer issue. even when not running the console at all and just installing the dependencies (running npm install
i can only open 6 tabs. using wing wasm outside of webcontainers works fine (the lsp is working even with 20 open tabs)
Checked with @eladcon
Even when you open https://stackblitz.com/edit/stackblitz-webcontainer-api-starter-tvjtvf?file=README.md 3 times, it stops working with the same issue
updated definition of done of the ticket
I got an idea to overcome this issue. As far as my experiments go, the memory is allocated per domain (eg: play.winglang.io vs learn.winglang.io).
If we instantiate the webcontainer in random subdomains such as abc-123.play.winglang.io
, we can open any number of apps. So, play.winglang.io would use an iframe to random-345.play.winglang.io. The users shouldn't notice a thing.
i think it would work, though we would need to manage those domains
Great idea. What do we need to serve from these subdomain?
We can have a wildcard subdomain going to the same location
Do we still need to solve this problem if we go with the backend solution?
I think that util we know that the backend solution is solid, we should treat it as a P2.
I want to be risk averse at this point in time
👍
So I tried going forward with my tests using dynamic subdomains such as abc123.play-test.winglang.io
, def456.play-test.winglang.io
, etc, inside an iframe published in play-test.winglang.io
.
There's a problem and is that the WASM files are being loaded in the topmost frame on the browser tab, which would be play-test.winglang.io, so it works the same unless we make our users open the playground using the subdomain URLs directly.
As @ainvoner mentioned, we prefer to receive traffic to from winglang.io directly so using subdomains isn't a viable option, but what if we do the following?
We can enable tab to tab communication between subdomains, so technically it isn't a problem.
Sounds reasonable to me
@skyrpex , this should be for learn as well
I tried this:
Open more than 5 tabs of the playground with this link
This happened:
The sixth tab threw an error
Subsequent new tabs were stuck in loading mode.![Screenshot 2023-06-09 at 17 43 40](https://github.com/winglang/wing/assets/136789/c2895ea6-292b-4952-9ce5-39b087137c9c)
I expected this:
Is there a workaround?
Don't open too many tabs (or buy more memory?) :)
Component
Playground
Wing Version
0.19.6
Wing Console Version
No response
Node.js Version
?
Platform(s)
MacOS
Anything else?
Notes:
While the first occurrence of this happened in a browser session with plenty of tabs, I was able to reproduce this with a fresh Chrome instance.
Each new tab seems to consumer 900 MB - 1 GB
Here's the related Slack thread
Community Notes
Definition of Done
Implementation notes