redhat-developer / vscode-server-connector

📦 Connects Visual Studio Code to your server adapters and run, deploy apps !!
Eclipse Public License 2.0
57 stars 26 forks source link

Multiple windows - rht server connector causes exception on server #445

Closed robstryker closed 3 years ago

robstryker commented 4 years ago

Jul 08, 2020 5:40:38 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint notify WARNING: Failed to send notification message. org.eclipse.lsp4j.jsonrpc.JsonRpcException: java.net.SocketException: Broken pipe (Write failed) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageConsumer.consume(StreamMessageConsumer.java:72) at org.eclipse.lsp4j.jsonrpc.TracingMessageConsumer.consume(TracingMessageConsumer.java:91) at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.notify(RemoteEndpoint.java:126) at org.eclipse.lsp4j.jsonrpc.services.EndpointProxy.invoke(EndpointProxy.java:88) at com.sun.proxy.$Proxy4.serverStateChanged(Unknown Source) at org.jboss.tools.rsp.server.model.RemoteEventManager.initClientWithServerStates(RemoteEventManager.java:101) at org.jboss.tools.rsp.server.ServerManagementServerImpl.clientAdded(ServerManagementServerImpl.java:121) at org.jboss.tools.rsp.server.ServerManagementServerLauncher.oneSocket(ServerManagementServerLauncher.java:158) at org.jboss.tools.rsp.server.ServerManagementServerLauncher.access$0(ServerManagementServerLauncher.java:140) at org.jboss.tools.rsp.server.ServerManagementServerLauncher$ListenOnSocketRunnable.run(ServerManagementServerLauncher.java:123) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.net.SocketException: Broken pipe (Write failed) at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111) at java.net.SocketOutputStream.write(SocketOutputStream.java:143) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageConsumer.consume(StreamMessageConsumer.java:68) ... 14 more

Jul 08, 2020 5:41:26 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint notify WARNING: Failed to send notification message. org.eclipse.lsp4j.jsonrpc.JsonRpcException: java.net.SocketException: Broken pipe (Write failed) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageConsumer.consume(StreamMessageConsumer.java:72) at org.eclipse.lsp4j.jsonrpc.TracingMessageConsumer.consume(TracingMessageConsumer.java:91) at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.notify(RemoteEndpoint.java:126) at org.eclipse.lsp4j.jsonrpc.services.EndpointProxy.invoke(EndpointProxy.java:88) at com.sun.proxy.$Proxy4.serverStateChanged(Unknown Source) at org.jboss.tools.rsp.server.model.RemoteEventManager.initClientWithServerStates(RemoteEventManager.java:101) at org.jboss.tools.rsp.server.ServerManagementServerImpl.clientAdded(ServerManagementServerImpl.java:121) at org.jboss.tools.rsp.server.ServerManagementServerLauncher.oneSocket(ServerManagementServerLauncher.java:158) at org.jboss.tools.rsp.server.ServerManagementServerLauncher.access$0(ServerManagementServerLauncher.java:140) at org.jboss.tools.rsp.server.ServerManagementServerLauncher$ListenOnSocketRunnable.run(ServerManagementServerLauncher.java:123) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.net.SocketException: Broken pipe (Write failed) at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111) at java.net.SocketOutputStream.write(SocketOutputStream.java:143) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageConsumer.consume(StreamMessageConsumer.java:68) ... 14 more

Jul 08, 2020 5:42:12 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint notify WARNING: Failed to send notification message. org.eclipse.lsp4j.jsonrpc.JsonRpcException: java.net.SocketException: Broken pipe (Write failed) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageConsumer.consume(StreamMessageConsumer.java:72) at org.eclipse.lsp4j.jsonrpc.TracingMessageConsumer.consume(TracingMessageConsumer.java:91) at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.notify(RemoteEndpoint.java:126) at org.eclipse.lsp4j.jsonrpc.services.EndpointProxy.invoke(EndpointProxy.java:88) at com.sun.proxy.$Proxy4.serverStateChanged(Unknown Source) at org.jboss.tools.rsp.server.model.RemoteEventManager.initClientWithServerStates(RemoteEventManager.java:101) at org.jboss.tools.rsp.server.ServerManagementServerImpl.clientAdded(ServerManagementServerImpl.java:121) at org.jboss.tools.rsp.server.ServerManagementServerLauncher.oneSocket(ServerManagementServerLauncher.java:158) at org.jboss.tools.rsp.server.ServerManagementServerLauncher.access$0(ServerManagementServerLauncher.java:140) at org.jboss.tools.rsp.server.ServerManagementServerLauncher$ListenOnSocketRunnable.run(ServerManagementServerLauncher.java:123) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.net.SocketException: Broken pipe (Write failed) at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111) at java.net.SocketOutputStream.write(SocketOutputStream.java:143) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageConsumer.consume(StreamMessageConsumer.java:68) ... 14 more

This error does not appear to be present in community version.

Steps to replicate: Open vscode, have both connector rsps started and running. Open a new vscode window. Stop the server connector in the second window. First window should now show both are stopped. Start both connectors in first window. In second window, attempt to start the connectors.

Community connector should start (ie connect) with no errors visible in first window. RHT connector should 'start' (ie connect) but show errors in first window's output area. Exception is shown above.

While my inclination is to assume this is a race condition of some type, it's strange that it's not replicatable for the community edition.

robstryker commented 4 years ago

This is a (possible) bug in the wait-on library as well as an issue with us not expecting this error and logging it appropriately. See https://github.com/jeffbski/wait-on/issues/68

Specifically, after starting the server, we wait for the connection to be available. While we might expect this library to attempt to connect, and, upon success, stop trying, this code actually attempts many many times to connect, waiting for some type of stability in the connection. It also disconnects very very quickly.

When a new connection is made in rsp-server, the server attempts to tell this new client the state of all servers. In the case of the wait-on library, the library disconnects before the server even has a chance to propogate the status of the declared servers on the rsp. When the RSP attempts to send that message, the client has already disconnected, causing the exception.

This can be viewed as either a bug in our adapter (use a better wait-on library) or a bug in the server (since odds are even our connection attempts would quickly disconnect even if we wrote this part of the code ourselves).

I choose to leave this issue open here, and create a duplicate issue at rsp-server to handle the error logging. The fact is our wait-on code is not functioning as desired, but the server has the ultimate responsibility to expect and log this message at a debug level.

robstryker commented 3 years ago

dependent issue has been closed