vscode-httpyac icon indicating copy to clipboard operation
vscode-httpyac copied to clipboard

"No connection established. Last error: null" after connection forcefully closed

Open ncsibra opened this issue 1 year ago • 4 comments

Steps to reproduce:

  1. Start a GRPC server locally.
  2. Start a long-running server stream to that server.
  3. Shutdown the server while the connection is still active in VS Code.
  4. Restart server.
  5. Try to call any endpoint from VS Code, either unary or stream endpoint, it will return a "No connection established. Last error: null".

At point 3, VS Code shows a "Call cancelled" message, so looks like the connection was terminated on both sides, but for some reason after the server restart it won't be able to connect back. Sometimes it solves itself after a few tries, sometimes deleting the sessions looks like work, but a lot of times I need to restart VS Code to work again. It does not happen if there is no pending connection to the server, only when a stream is in progress and the server is forcefully stopped, which can happen a lot during development.

The relevant log entry:

Error: Error: 14 UNAVAILABLE: No connection established. Last error: null
	at AU.<anonymous> (/home/ncsibra/.vscode-server/extensions/anweber.vscode-httpyac-6.14.0/dist/extension.js:137:158735)
	at AU.emit (node:events:518:28)
	at Object.onReceiveStatus (/home/ncsibra/.vscode-server/extensions/anweber.vscode-httpyac-6.14.0/dist/extension.js:90:5903)
	at Object.onReceiveStatus (/home/ncsibra/.vscode-server/extensions/anweber.vscode-httpyac-6.14.0/dist/extension.js:88:8193)
	at /home/ncsibra/.vscode-server/extensions/anweber.vscode-httpyac-6.14.0/dist/extension.js:104:30902
	at process.processTicksAndRejections (node:internal/process/task_queues:77:11)

ncsibra avatar Jun 20 '24 10:06 ncsibra

It also happens with simple unary streams when the last call before the server shutdown fails.

ncsibra avatar Jun 21 '24 12:06 ncsibra

@ncsibra Unfortunately, I can't recreate the error. For me, it always returns a Call Canceled and I can simply send further requests.

sometimes deleting the sessions looks like work

Yes, that should always fix the error. The reference to a previous client is in the session and I would establish a new connection/ client without a session.

The error is thrown by grpc-js (see load-balancer-round-robin.ts#L157 Error reads similar to https://github.com/grpc/grpc-node/issues/2694

AnWeber avatar Aug 22 '24 14:08 AnWeber

Can I provide you with more logs to help you solve this? Or is it possible to recreate the client when you get an error like this?

ncsibra avatar Aug 22 '24 16:08 ncsibra

@ncsibra I would just do a release where I log out more information. In other words, run the error once with LogLevel.trace after the release, this could help. Otherwise I would have tried to reproduce it with the docker container of grpcb.in docker run -it --rm -p 9000:9000 -p 9001:9001 moul/grpcbin) as a server. If you provide me with a simple server project that has a longer connection and you can produce the error there, that might help too. I've read a bit of the code and yes I don't actively destroy the client on error, but the session delete should have taken care of that. So reproducing the error would be very helpful.

AnWeber avatar Aug 22 '24 19:08 AnWeber

please reopen ticket if you can provide a way to recreate the error or I got more information. thx

AnWeber avatar Nov 03 '24 19:11 AnWeber