theia-ide / theia-apps

Theia applications examples - docker images, desktop apps, packagings
Apache License 2.0
1.04k stars 345 forks source link

Web Theia stucks opening big file (around 25MB) #438

Closed davide-sergi closed 3 years ago

davide-sergi commented 3 years ago

We have a Theia web application instance deployed in a remote server of our intranet. When we try to open a big file (25MB):

By trying to run theia locally (on localhost) all work fine. Could be an issue related to slow downlaod speed? There are some timeout in frontend and/or backend part that trigger a websocket closing and reopening ?

marcdumais-work commented 3 years ago

@davide-sergi can you confirm if you saw anything suspicious in either the browser console or backend console log?

I think we've relatively recently added configurable support to prevent opening huge files. I am thinking this may be getting in the way. IIRC there's a preference for it - maybe try to see what it's set at for the app that fails.

davide-sergi commented 3 years ago

@marcdumais-work: I checked .theia/settings.json file, and there are not particular "critical" settings. image

Anyway I don't think that this issue could be related to a configuration aspect. Because same scenario happens by using vs-code/python extension, installed as plugin in this instance of Theia. In fact, when I try to open a jupyter notebook:

Note: Only sometimes (very rarely) the download gone successfully, but when it happens the content of file (index_bundle.js) seems truncated (11-15 MB instead of 25MB)

image image image

davide-sergi commented 3 years ago

@marcdumais-work

As assumed what we faced was an issue related to a timeout set on the Theia backend server (and not front-end). In particular, over websocket, server implements a kind of Keep Alive protocol (see image below). Every 30sec server sends a ping to the client and check if previous ping (sent 30 sec ago) has been confirmed with a "pong" ( 😊 ) by the client. If not websocket is disposed. Im my opinion, during downloading process client receives late this ping message because sent over same websocket channel used for download (at that time full for downloading). So client is not able to sends pong in time.

@theia/core/src/node/messaging/messaging-contribution.ts image