Theia IDE websocket disonnects every 30 sec when serving in Kubernetes behind ingress

598 views Asked by At

I have a kubernetes ingress configured on google cloud with a managed certificate. Then I have the theia/theia-full docker image as a pod and a kubernetes service connecting the ingress and the pod.

The initial load of the theia page in my browser works and all plugins are started in the backend. After that every 30sec the browser issues another websocket request to wss://mytheiadomain. The theia backend logs

root ERROR [hosted-plugin: 59] Error: connection is closed
    at Object.create (/home/theia/node_modules/@theia/plugin-ext/lib/common/rpc-protocol.js:82:30)
    at Object.<anonymous> (/home/theia/node_modules/@theia/plugin-ext/lib/common/rpc-protocol.js:108:56)
    at Object.disposable.dispose (/home/theia/node_modules/@theia/core/lib/common/disposable.js:101:13)
    at DisposableCollection.dispose (/home/theia/node_modules/@theia/core/lib/common/disposable.js:78:40)
    at RPCProtocolImpl.dispose (/home/theia/node_modules/@theia/plugin-ext/lib/common/rpc-protocol.js:129:24)
    at /home/theia/node_modules/@theia/plugin-ext/lib/hosted/node/plugin-host.js:142:21
    at step (/home/theia/node_modules/@theia/plugin-ext/lib/hosted/node/plugin-host.js:48:23)
    at Object.next (/home/theia/node_modules/@theia/plugin-ext/lib/hosted/node/plugin-host.js:29:53)
    at fulfilled (/home/theia/node_modules/@theia/plugin-ext/lib/hosted/node/plugin-host.js:20:58)
    at processTicksAndRejections (internal/process/task_queues.js:97:5) {
  code: 'RPC_PROTOCOL_CLOSED'
}
root INFO [e894a0b2-e9cd-4f35-8167-89eb28e840d8][typefox.yang-vscode]: Disconnected.
root INFO [e894a0b2-e9cd-4f35-8167-89eb28e840d8][rebornix.ruby]: Disconnected.
root INFO [e894a0b2-e9cd-4f35-8167-89eb28e840d8][ms-python.python]: Disconnected.
...

and all plugins disconnect and initialize again. (sometimes I don't even get this error message and the plugins just disconnect and initialize)

If I cut the wifi connection of my browser this does not happen! So the browsers wss request seems to trigger the restart. The disconnect every 30sec does not happen if I run theia-full locally on plain docker.

This is as far as I got tracing the error after a few hours of searching. Any hint would be appreciated. I can provide more log output and my configuration files.

1

There are 1 answers

1
Jonas On

The default timeout for Google Load Balancers is 30 seconds.

For external HTTP(S) load balancers and internal HTTP(S) load balancers, if the HTTP connection is upgraded to a WebSocket, the backend service timeout defines the maximum amount of time that a WebSocket can be open, whether idle or not.

You need to create a custom BackendCondig with the timeout that you want.