-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Fail to create tls-proxy for the second process. #2200
Comments
Nice catch! One workaround is to handle TLS in a reverse proxy, then
code-server won't have to create the TLS proxy.
Maybe we should use a path in the user's data directory instead? Then we
won't have any permission issues or users stepping on other users' toes.
Or we could use a random path in /tmp which would do the same thing
(this is how VS Code does it).
I'm not sure about the double pages directory though. The HTML that
loads that script is:
```
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/dist/pages/vscode.js"></script>
```
So it seems like it shouldn't be possible. I'm not able to replicate
with our 3.5.0 release but I'll keep an eye out for it. It might be a
bug in the build process that doesn't occur in CI.
|
I try to replicate this time and it is gone now. But I find a very very interesting thing! I wrap my url to the code-server with nativefier to create a standalone native application in Win10. Within the built-in console in the wrapped app, I run a new code-server process on my remote server on a different port. Normally it should print some logs, and I should open a new chrome page and visit the new port. However, this time a new window of the native app is automatically created, which lead me to the code-server service on the new port! |
Now everything is crazy. As I said in the last comment, running code-server within the console of the native application wrapped by nativefier, a new window is displayed as ask for password. Since the new code-server command is simply Next, I want to replicate this, so I close the new window, and run the code-server in the native app again. This time a new window is created but nothing is displayed. What is worst is that the original code-server process is corrupted! I check the log of the first code-server process, and it says:
To conclude everything above: If two code-servers are started by the same user, then the second process may still try to use the tls-proxy created by the first process (note that here I fix the bug mentioned above and use the code-server binary built by myself), which may corrupt everything. Notice that the tls-proxy file is indeed accessible by the second process, but the connection number is limitted. When I say 'the original code-server process is corrupted', I mean that even if I stop all other code-server process, and the tls-proxy does not exist (It is not manually deleted, I think it is deleted by other code-server process on exit). The original code-server process still holds some kind of handler to that deleted tls-proxy file. So when new connection comes, instead of creating a new tls-proxy, it tries to connect the deleted socket file, which will certainly fail. |
code-server --version
: 3.5.0When running two process in the same server by two different users, the second one won't work and gives the following error:
Notice that the
tls-proxy
is created by the first process. Obviously, it is not accessible by the second process.After a little research, I find out that this bug is caused by a logic error in
socket.ts
, line 94.which should be
When the current path is not accessible, then try next one.
There is another problem here: the directory
/tmp/code-server
is created and owned by the first user, which means this directory is not writable for the second user, so the new socket filetls-proxy-1
cannot be created. I have to manually change the permissions of the directory to make everything works.Ok I forget one last thing. When I fix every as discribed above, the web client still shows nothing. After checking chrome console, a 404 error occurs for file in path
code-server/release-standalone/dist/pages/pages/vscode.js
. Notice that there are twopages
here, while the structure of the dist folder isdist/pages/vscode.js
. I have to manually create anotherpages
folder, and copy everything else into it.finally, everything works fine.
The text was updated successfully, but these errors were encountered: