Closed
Description
Description
When I'm running the browser
sample, occasionally the browser tab crashes reporting "Out of Memory".
It appears that the setup_proxy_console
(debug.ts
) called from the dotnet-crypto-worker.js
modifies the console
functions to send all logs over a websocket. The crash that I ran into occurs when the websocket connection fails and the onerror
event logs this failure. This leads to an indirect infinite recursion bertween the local function send
and the console.log
replacement function and the browser tab runs out of memory in just a few seconds (the worker allocates over 3.5 GB of memory).
It seems this bug was introduced in #71693
Reproduction Steps
- Build dotnet for Browser
.\build.cmd mono+libs+packs -os Browser -c Release
- Build the
browser
sample:.\dotnet.cmd build src\mono\sample\wasm\browser
- Serve the output directory:
.\dotnet.cmd serve -d:src\mono\sample\wasm\browser\bin\Release\AppBundle -h "Cross-Origin-Opener-Policy:same-origin" -h "Cross-Origin-Embedder-Policy:require-corp" -o -p:8000
- Open http://localhost:8000 in Edge or Chrome
- Open dev tools and refresh the page until you see
WebSocket connection to 'ws://localhost:8000/console' failed
in the console. It doesn't happen every time but it happens very often so you might need to refresh the page several times. - Switch to the Memory tab in the dev tools and watch the heap size of dotnet-crypto-worker.js grow rapidly
- The browser tab will crash in 30-60 seconds
Expected behavior
The browser tab doesn't crash.
Actual behavior
The browser tab crashes.
Regression?
No response
Known Workarounds
No response
Configuration
- Current
main
branch (after Better error handling in SubtleCrypto workers #71693) - Windows 11, x64
- Edge, Chrome
- I'm quite certain the problem is the infinite indirect recursion I described previously and therefore it should be independent of this configuration
Other information
No response