xtermjs / xterm.js

A terminal for the web
https://xtermjs.org/
MIT License
17.44k stars 1.62k forks source link

xtermjs 5.3.0-2 not working on proxmox shell GUI in Chrome Browser on iPAD and iPhone #4894

Closed divkoro closed 9 months ago

divkoro commented 9 months ago

In Proxmox PVE 8.1.3: Update on 15.11.2023 of pve-xtermjs from 4.16.0-3 to 5.3.0-2 broke shell GUI in Chrome Browser on iPAD and iPhone (both iOS 17.1.1 and 16.x.x). Terminal Tab is blank and empty, no prompt. Falling back to 4.16.0-3 restores terminal function again. It does work in Firefox on same iPAD, Chrome on Windows, as well as in Firefox on Windows and Linux (openSuse, Leap 15.5.)

Google Chrome | 119.0.6045.169 (Offizieller Build) stable (64-Bit) Überarbeitung | 282ae04c0e5df01793a71640f8e6737f9cda8c64-refs/branch-heads/6045@{#1338} Betriebssystem | iOS User-Agent | Mozilla/5.0 (iPad; CPU OS 17_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/119.0.6045.169 Mobile/15E148 Safari/604.1 Befehlszeile | /var/containers/Bundle/Application/4F7CF15D-79E8-4CBD-A0B3-1D4B0C0D9EFC/stable.app/Chrome --gaia-url=https://accounts.google.com/ --lso-url=https://accounts.google.com/ --google-apis-url=https://oauth2.googleapis.com/ --flag-switches-begin --flag-switches-end

Steps to reproduce

1) Use Google Chrome as browser on iPAD 2) empty cache 3) Start pve GUI and select a pve node 4) press shell button, select xterm.js, i.e. start terminal session to pve node 5) Terminal Window opens in new tab with empty screen, no prompt, no input possibility, no keypad

In parallel tab with chrome://inspect entered, the logging output is: xtermjs: starting

divkoro commented 9 months ago

Does work in Safari too

jerch commented 9 months ago

Plz report it to pve-xtermjs, so they can check if it is an xterm.js issue or caused by other things.

divkoro commented 9 months ago

They requested it to move to this list: Bug 5063 - xterm.js not working on iPAD and iPhone with Chrome since 15-11- (edit)

Dominik Csapak 2023-11-29 10:26:39 CET: thanks for the information. sadly it does not really tell us anything since there were no error logged.

since our xtermjs wrapper is very thin (basically just open/read from the websocket and pipe it into xtermjs)

would you mind opening a bugreport upstream? maybe they have more information on how to properly debug this: (we don't have an ipad/iphone to debug here currently) https://github.com/xtermjs/xterm.js

Tyriar commented 9 months ago

My guess is your browser doesn't support webgl2, do they allow you to disable the webgl addon?

jerch commented 9 months ago

@Tyriar Maybe also related to those chrome GPU issues several weeks ago?

@divkoro The webgl renderer is not the new default renderer for xterm.js, default since v5 is the DOM renderer. Maybe pve-xtermjs has set webgl to their default, but with offering anything other than the DOM renderer they also should provide a way to customize the renderer by the user, as the canvas and the webgl renderer are known to run into issues on certain hardware & browser constellations. Especially chrome was recently (v108+) more on the glitchy side of things. Those glitches also cannot be spotted from JS side, so there is not much we can do about.

divkoro commented 9 months ago

Intermediate result: after little debugging and tricking the iPad Chrome Browser not to chache javascript code it turned out, Chrome on iPad gets stuck in WebglAddon:

....

// console.log('main.js: (before webglAddon'); .... const webglAddon = new WebglAddon.WebglAddon(); // ---> never returns // console.log('main.js: (after webglAddon ');

createTerminal();
....

"WebglAddon.WebglAddon()" never returns; createTerminal is never called

Implementation of Webgl in Chromme on iPAD seams to be obviously glitchy. Nevertheless this should be caught before using it.

jerch commented 9 months ago

@divkoro Can you step-debug the ctor? Note that the ctor does not much beside setting up a few events and creating a canvas element (real heavy lifting happens later during activate). I see no reason what should block here, note that any JS call creating a block/hang on the browser is most likely always a browser issue, JS is not meant to achieve that by any means (beside busy loops).

Link to the ctor: https://github.com/xtermjs/xterm.js/blob/fb2c39cb5748e071e0a1ed49824590aafd45e65e/addons/addon-webgl/src/WebglAddon.ts#L31-L47

What might help here is to check for any cmdline errors, playing around with GPU settings etc. And if you are up to it, plz also check different chrome versions and/or if you have strict security settings enabled. As I wrote above chrome made several changes to their internal GPU stack recently, which already caused quite some fuzz here.

divkoro commented 9 months ago

I'll try, but "cmd line", "different versions", "step debug" on iPAD? Any instructions/suggestions welcome. The affected Version of Chrome is in my first post.

jerch commented 9 months ago

Hmm well debugging iOS stuff needs some heavy tech stack, if you only do that as an ipad user you are basically out of luck. You might get somewhere with a terminal though, but idk if you get far enough with diagnostics w'o a jailbreak (dont do that unless you know what you are doing).

Imho no one of us can look into that, we are mostly on linux/windows. I suggest to ask the pve-xtermjs maintainer to provide a renderer switch in their integration, this would at least fix your issue with xterm.js. Idk if google offers different chome versions for ipad, if so maybe try a different one. If not - yeah welcome to the "golden cage and dont make me think" age. Whether there is really a more fundamental issue with recent chrome on ipad remains unclear until someone can debug that more in detail.