Closed DOBRO closed 1 year ago
So we'd have more than one server trying to listening the same port?
The server should be able to serve multiple connections concurrently. Unfortunately, it's not so far.
For example, if we open two windows (workspaces) in VSCode that use Perl::LanguageServer
, the server crashes and can't start after that. See full log attached
LanguageServer-error.log
Forgot to mention, I use VSCode + Perl extension https://marketplace.visualstudio.com/items?itemName=richterger.perl
I know that this error is annoying, but I don't think that this is a viable solution and it isn't as simple as setting the socket options to allow rebind, since it will open another issue. It would now be possible to launch two server instances on the same port from different projects such that the data can get corrupted by the corresponding other project. This issue would be critical. You should prefer to close all crashed Perl Language Server instances on your machine ( see #122 for a script solution with VSCode Tasks) and restart the Perl Language Server by reloading the window.
It is not possible to run more than one server listening on the same Port. So if you what to run the LanguageServer for two projects on the same machine you need to tell him to use different ports for the debugger. See setting perl.debugAdapterPort
.
SO_REUSEADDR helps when one process closeses the port, that a new language server can resue the port immediately.
Running multiple LanguageServers is solved in 2.4.0
PR resolves the issue regarding the error message:
tcp_bind: Address already in use at .../Perl/LanguageServer.pm line 418.
There are a lot of formatting, so the main changes are in this block: https://github.com/DOBRO/Perl-LanguageServer/commit/2d81be645f88fcf20d65a8c38e4cfbdf2f891d0b?branch=2d81be645f88fcf20d65a8c38e4cfbdf2f891d0b&diff=unified#diff-58026e237d19c9a3c4b8d488df11821f10e93a2b5e581e9d52a5cb4548f4e533R427-R431