You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior:
Emacs LSP client package lsp-mode runs docker-langserver executable with --stdio argument. It works well with docker-language-server installed on the same host, but there's an issue if you instead try to use the official docker image.
Wrapper script to execute the server in a container:
#!/bin/bashexec podman run -i --rm --network=none rcjsuen/docker-langserver:latest "$@"
What's wrong:
On opening a file of Dockerfile format in Emacs the container successfully starts, LSP client and server begin message exchange, but 3 seconds later the container shuts down with exit code 1 without any visible reason.
Why:
Running the container with exit trace shows that the issue happens in vscode-languageserver dependency code.
(node:1) WARNING: Exited the environment with code 1
at exit (node:internal/process/per_thread:187:13)
at /docker-langserver/node_modules/vscode-languageserver/lib/node/main.js:101:29
at listOnTimeout (node:internal/timers:573:17)
at processTimers (node:internal/timers:514:7)
Corresponding code in node_modules/vscode-languageserver/lib/node/main.js:
constwatchDog={initialize: (params)=>{constprocessId=params.processId;if(Is.number(processId)&&exitTimer===undefined){// We received a parent process id. Set up a timer to periodically check// if the parent is still alive.setInterval(()=>{try{process.kill(processId,0);}catch(ex){// Parent process doesn't exist anymore. Exit the server.process.exit(_shutdownReceived ? 0 : 1);}},3000);}},getshutdownReceived(){return_shutdownReceived;},setshutdownReceived(value){_shutdownReceived=value;},exit: (code)=>{endProtocolConnection();process.exit(code);}};
So as it turns out, an LSP client sends its PID as processId within its first initialization request message to server, and the server code checks if that PID is still alive with a 3000ms interval, but obviously can't find that PID within a container namespace. Guess this check has to be turned off in the docker image.
The text was updated successfully, but these errors were encountered:
@rcjsuen The only other LSP server written in typescript that I'm also using is bash-language-server and I had the same issue trying to run the latest release in a container. They don't publish their own official image though.
Now that you asked about that library, I suddenly noticed this code and gotta say that running the server in a container with --clientProcessId 1 does the magic, the watchdog ignores the PID provided by the client during session initialization.
Guess that solves the issue — but I know very little about the subject, so if you don't consider it a reliable workaround then maybe it's worth mentioning.
Expected behavior:
Emacs LSP client package
lsp-mode
runsdocker-langserver
executable with--stdio
argument. It works well with docker-language-server installed on the same host, but there's an issue if you instead try to use the official docker image.Wrapper script to execute the server in a container:
What's wrong:
On opening a file of Dockerfile format in Emacs the container successfully starts, LSP client and server begin message exchange, but 3 seconds later the container shuts down with exit code 1 without any visible reason.
Why:
Running the container with exit trace shows that the issue happens in
vscode-languageserver
dependency code.stderr.log
:Corresponding code in
node_modules/vscode-languageserver/lib/node/main.js
:So as it turns out, an LSP client sends its PID as
processId
within its first initialization request message to server, and the server code checks if that PID is still alive with a 3000ms interval, but obviously can't find that PID within a container namespace. Guess this check has to be turned off in the docker image.The text was updated successfully, but these errors were encountered: