tuzig / terminal7

A Next Generation Terminal running over WebRTC
https://terminal7.dev
GNU General Public License v3.0
161 stars 21 forks source link

Gracefully handle lost webgl context #341

Closed daonb closed 1 month ago

daonb commented 1 year ago

Describe the bug Sometimes, there are too many open panes and the browser runs out of memory. This results in a webglcontextlost event which T7 doesn't handle today.

The proposed solution, is to handle the event by closing all the gates, destroying, re-initing TWR terminal and displaying a notification: "Out of memory. Closed all gates."

To Reproduce Steps to reproduce the behavior:

  1. Launch app
  2. Tap on Server
  3. Keep Splitting and adding tabs till you don't get a prompt.

Additional context

This is a known issue with browser supporting 8-16 WebGL contexts. We're using virtualgl to break this limit, but still, contexts have been lost.

eyal-sasson commented 1 year ago

Unable to recreate, might be Safari only. Does this bug still occur in #325?

daonb commented 1 year ago

I guess the limit on mobile safari is smaller but still I managed to recreate it on chrome. It's not so easy to detect: open the console and search for

"WARNING: Too many active WebGL contexts. Oldest context will be lost."

Limiting won't help as I can have as many gates as I want each with the maximum number of panes.

daonb commented 1 year ago

Also got on the iPad in the console: "Total canvas memory use exceeds the maximum limit (736 MB)." image