Skip to content

Experimental initial connection fix #2250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 2, 2020
Merged

Experimental initial connection fix #2250

merged 4 commits into from
Nov 2, 2020

Conversation

code-asher
Copy link
Member

So far the only way I've been able to reproduce the initial connection failure is to spawn 10+ tabs at a time. What I saw was that sometimes the initial message from the client doesn't make it to onControlMessage callback which causes the handshake to hang. I don't know yet why that is but for now I've made it so both ends will initiate the handshake so no matter what order or when they start listening everything should be fine.

So far with this I haven't seen any connection failures due to incomplete handshakes (although when I spawn too many windows my browser seems to just not make websocket connections in the first place, but that results in different errors than the reported ones).

@@ -1273,7 +1273,8 @@ index 0000000000000000000000000000000000000000..ab020fbb4e4ab3748cc807765ff9c362
+// Wait for the init message then start up VS Code. Subsequent messages will
+// return new workbench options without starting a new instance.
+process.on('message', async (message: CodeServerMessage, socket) => {
+ logger.debug('got message from code-server', field('message', message));
+ logger.debug('got message from code-server', field('type', message.type));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

@nhooyr
Copy link
Contributor

nhooyr commented Oct 30, 2020

(We discussed a different approach on slack)

@code-asher code-asher force-pushed the disconnects branch 3 times, most recently from cde3054 to 64a0efb Compare October 30, 2020 20:55
This way the connection can be initiated by either side. It looks like
sometimes the initial message from the client is lost (it never makes it
into the onControlMessage callback) but I'm still not sure why or if
that is preventable.

Also added a timeout on the server end to clean things up in case the
client never responds.
This will buffer any data sent to it until something is ready to listen
on it.
@code-asher code-asher marked this pull request as ready for review November 2, 2020 18:28
@code-asher code-asher merged commit 676c7bf into master Nov 2, 2020
@code-asher code-asher deleted the disconnects branch November 2, 2020 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants