eclipse-theia/theia

Error: Connection is closed due to `settings.json`, `launch.json`, and `tasks.json` ?

Ouverte

#6 424 ouverte le 21 oct. 2019

 (1 commentaire) (0 réaction) (0 personne assignée)TypeScript (2 478 forks)batch import
bughelp wanted

Métriques du dépôt

Stars
 (18 676 étoiles)
Métriques de merge PR
 (Métriques PR en attente)

Description

Description

I am not sure but every time I close the electron application (started from source) I see the following error in the console:

root ERROR Uncaught Exception:  Error: Connection is closed.
root ERROR Error: Connection is closed.
    at throwIfClosedOrDisposed (/Users/akos.kitta/git/theia/node_modules/vscode-jsonrpc/lib/main.js:673:19)
    at Object.sendRequest (/Users/akos.kitta/git/theia/node_modules/vscode-jsonrpc/lib/main.js:782:13)
    at /Users/akos.kitta/git/theia/packages/core/lib/common/messaging/proxy-factory.js:310:72
    at new Promise (<anonymous>)
    at /Users/akos.kitta/git/theia/packages/core/lib/common/messaging/proxy-factory.js:303:24
    at process._tickCallback (internal/process/next_tick.js:68:7)
root ERROR Uncaught Exception:  Error: The channel has been disposed.
root ERROR Error: The channel has been disposed.
    at WebSocketChannel.checkNotDisposed (/Users/akos.kitta/git/theia/packages/core/lib/common/messaging/web-socket-channel.js:52:19)
    at WebSocketChannel.close (/Users/akos.kitta/git/theia/packages/core/lib/common/messaging/web-socket-channel.js:92:14)
    at WebSocket.<anonymous> (/Users/akos.kitta/git/theia/packages/core/lib/node/messaging/messaging-contribution.js:198:29)
    at WebSocket.emit (events.js:187:15)
    at WebSocket.emitClose (/Users/akos.kitta/git/theia/packages/core/node_modules/ws/lib/websocket.js:193:10)
    at Socket.socketOnClose (/Users/akos.kitta/git/theia/packages/core/node_modules/ws/lib/websocket.js:861:15)
    at Socket.emit (events.js:182:13)
    at TCP._handle.close (net.js:606:12)
root ERROR Uncaught Exception:  Error: Connection is closed.
root ERROR Error: Connection is closed.
    at throwIfClosedOrDisposed (/Users/akos.kitta/git/theia/node_modules/vscode-jsonrpc/lib/main.js:673:19)
    at Object.sendRequest (/Users/akos.kitta/git/theia/node_modules/vscode-jsonrpc/lib/main.js:782:13)
    at /Users/akos.kitta/git/theia/packages/core/lib/common/messaging/proxy-factory.js:310:72
    at new Promise (<anonymous>)
    at /Users/akos.kitta/git/theia/packages/core/lib/common/messaging/proxy-factory.js:303:24

I added some console logging:

diff --git a/packages/core/src/common/messaging/proxy-factory.ts b/packages/core/src/common/messaging/proxy-factory.ts
index 27676d312..043de3469 100644
--- a/packages/core/src/common/messaging/proxy-factory.ts
+++ b/packages/core/src/common/messaging/proxy-factory.ts
@@ -239,7 +239,10 @@ export class JsonRpcProxyFactory<T extends object> implements ProxyHandler<T> {
                         } else {
                             const resultPromise = connection.sendRequest(method, ...args) as Promise<any>;
                             resultPromise
-                                .catch((err: any) => reject(this.deserializeError(capturedError, err)))
+                                .catch((err: any) => {
+                                    console.log(`error when requesting '${method}' with args: {${JSON.stringify(args)}}`, err);
+                                    reject(this.deserializeError(capturedError, err));
+                                })
                                 .then((result: any) => resolve(result));
                         }
                     } catch (err) {

Finally, I could see the real issue:

root INFO error when requesting 'resolveContent' with args: {["file:///Users/akos.kitta/git/theia/.theia/tasks.json",null]} Error
    at handleResponse (file:///Users/akos.kitta/git/theia/examples/electron/lib/bundle.js:80023:36)
    at processMessageQueue (file:///Users/akos.kitta/git/theia/examples/electron/lib/bundle.js:79847:9)
    at Immediate.<anonymous> (file:///Users/akos.kitta/git/theia/examples/electron/lib/bundle.js:79830:7)
    at runCallback (timers.js:694:18)
    at tryOnImmediate (timers.js:665:5)
    at processImmediate (timers.js:647:5)
root INFO [nsfw-watcher: 15573] Started watching: /Users/akos.kitta/git/theia/.vscode/settings.json
root INFO error when requesting 'resolveContent' with args: {["file:///Users/akos.kitta/git/theia/.theia/launch.json",null]} Error
    at handleResponse (file:///Users/akos.kitta/git/theia/examples/electron/lib/bundle.js:80023:36)
    at processMessageQueue (file:///Users/akos.kitta/git/theia/examples/electron/lib/bundle.js:79847:9)
    at Immediate.<anonymous> (file:///Users/akos.kitta/git/theia/examples/electron/lib/bundle.js:79830:7)
    at runCallback (timers.js:694:18)
    at tryOnImmediate (timers.js:665:5)
    at processImmediate (timers.js:647:5)
root INFO error when requesting 'resolveContent' with args: {["file:///Users/akos.kitta/git/theia/.vscode/tasks.json",null]} Error
    at handleResponse (file:///Users/akos.kitta/git/theia/examples/electron/lib/bundle.js:80023:36)
    at processMessageQueue (file:///Users/akos.kitta/git/theia/examples/electron/lib/bundle.js:79847:9)
    at Immediate.<anonymous> (file:///Users/akos.kitta/git/theia/examples/electron/lib/bundle.js:79830:7)
    at runCallback (timers.js:694:18)
    at tryOnImmediate (timers.js:665:5)
    at processImmediate (timers.js:647:5)

On app stop, something tries to resolve the content of the settings.json, launch.json and tasks.json files. I do not see the same errors with the browser example. I do not know if this is an electron issue only.

Reproduction Steps

Build and start theia electron from the source. Close the app with Cmd+Q (on macOS).

OS and Theia version: macOS f255f5a8c

Diagnostics:

Guide contributeur