Closed levans closed 3 years ago
Hi, thanks for the bug report, there was a similar issue, involving yesod and macos: #230. It was closed as possible duplicate of #469. We should have the logs to confirming though.
Thanks Javier. I don't have have haskell-language-server on my path (was downloaded by the VSCode extension and presumably cached somewhere). If you'd like me to run haskell-language-server --debug .
, would you happen to know where the executable is cached?
I've attached the log file generated by setting a file into the VSCode extension settings. vscode_hls.log
Thanks, the vscode log would be enough to confirm it is not a duplicate of #230. At least the compiler panic is not present. In fact there is no error logged before the crash afaics :worried: I guess it could be related with the eval plugin, that is inestable and is causing crashes (see #633) but there is no log about it so not sure.
To try to workraround the issue and find the possible cause we can disable all plugins and reenable it one by one.
To do it you can add a settings.json
file inside a subdir in the project named .vscode
, with this content:
{
"haskell": {
"plugin" : {
"importLens" : {
"globalOn" : false
},
"hlint" : {
"globalOn" : false
},
"eval" : {
"globalOn" : false
},
"moduleName" : {
"globalOn" : false
},
"splice" : {
"globalOn" : false
},
"haddockComments" : {
"globalOn" : false
},
"class" : {
"globalOn" : false
},
"retrie" : {
"globalOn" : false
},
"tactic" : {
"globalOn" : false
},
"pragmas" : {
"globalOn" : false
}
}
}
}
... and test if the crash is reproduced As the eval plugin is the main suspect i would start enabling it to reproduce it.
Added the settings file and restarted vscode.
Left all the global settings set to false on the first try, but found that there's absolutely no difference in behaviour.
I have attached the log from that run, where you can see the settings reproduced, but the vscode extension still crashes in a loop.
@levans thanks for trying it, from the log we can deduce that the configuration is in effect, cause the specific log for plugins is not included anymore. And as all plugins are disabled the component causing the crash is probably ghcide.
Is there some template haskell used in the module? Iirc yesod make heavy use of th so probably that will be the case.
Indeed Yesod makes a good deal of use of TH and quasiquotation for a number of embedded languages (HTML, CSS, data definition). The scaffold creates a range of modules with various examples of these.
I have had a similar situation on macOS with VSCodium when I include Template Haskell through the optics or lens libraries.
I have a similar situation where whenever I open a haskell project in VSC I get a message from the haskell extension saying The Haskell (test) server crashed 5 times in the last 3 minutes. The server will not be restarted.
. Initially I got an error saying that the haskell language server was not available for linux and so I installed it myself via AUR.
I suspect I'm also encountering this bug; Mojave 10.14.05
with VSCode
. In a project, I'm using deriveGEq
from dependent-sum-template
:
data NumericLit a where
NaturalLit :: NumericLit Natural
IntegerLit :: NumericLit Integer
DoubleLit :: NumericLit Double
deriveGEq ''NumericLit
data ComponentSpec a where
NumericLit :: NumericLit a -> ComponentSpec a
BoolLit :: ComponentSpec Bool
TextLit :: ComponentSpec Text
-- deriveGEq ''ComponentSpec -- Uncomment and go boom
FWIW, I just relaunched VSCode to pick up 1.0.0 and immediately after the automatic update, the project seemed to be working fine. However, as soon as I relaunched VSCode I was back to the same behaviour. So, there's perhaps some difference in what happens during/post update vs the full reset when starting up normally.
I've also had this and #1297 occur on my Nix-based development environment, I haven't tried reproducing it on a smaller, TH-less project yet though, but using a standard ghcup
setup with seems to work fine w/o extra configuration.
I'm running into the same issue using hasql-th
quasiquoters. It's easily reproduced, the simple splice [singletonStatement| select 1 :: int2 |]
will crash the server.
Is this the same issue as #1297 ? Seems very similar if not identical
Yeah, symptoms are quite generic unfortunately: crashes without useful info and template haskell usage :worried: I am gonna close this in favor of #1297 optimistically, assuming the undelrying cause will be the same. I am gonna link this comment, maybe it is useful to diagnose it.
I'm running into the same issue using
hasql-th
quasiquoters. It's easily reproduced, the simple splice[singletonStatement| select 1 :: int2 |]
will crash the server.
It's possible that you probably also hit the same issue we did with a mix of postgresql/TH in https://github.com/haskell/haskell-language-server/issues/1982#issuecomment-872582918
I'm still getting this problem (server crash) or some of my Macs. Could not track the cause. Everything's the latest released.
All I can say that the workaround of starting VSC manually via code .
command in the Terminal window works. But (a) it "ruins" that window because it now becomes "polluted" with the messages like
$ [main 2022-03-16T17:55:36.024Z] window#load: attempt to load window (id: 1)
[main 2022-03-16T17:55:36.045Z] update#setState idle
[main 2022-03-16T17:55:36.328Z] ExtensionHostStarterWorker created
2022-03-16 13:55:36.905 Code Helper (Renderer)[11599:2716338] CoreText note: Client requested name ".NewYork-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2022-03-16 13:55:36.905 Code Helper (Renderer)[11599:2716338] CoreText note: Set a breakpoint on CTFontLogSystemFontNameRequest to debug.
[main 2022-03-16T17:55:37.101Z] window#load: window reported ready (id: 1)
[main 2022-03-16T17:55:46.048Z] Unable to resolve your shell environment in a reasonable time. Please review your shell configuration.
[main 2022-03-16T17:55:46.049Z] Unable to resolve your shell environment in a reasonable time. Please review your shell configuration.
[main 2022-03-16T17:55:46.049Z] RequestService#request resolving shell environment failed Error: Unable to resolve your shell environment in a reasonable time. Please review your shell configuration.
at Timeout.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:67:1743)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)
[main 2022-03-16T17:55:46.082Z] Starting extension host with pid 11664 (fork() took 4 ms).
[main 2022-03-16T17:55:46.082Z] ExtensionHostStarterWorker.start() took 5 ms.
[main 2022-03-16T17:56:06.048Z] update#setState checking for updates
[main 2022-03-16T17:56:07.090Z] update#setState idle
(node:11620) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Code Helper (Renderer) --trace-deprecation ...` to show where the warning was created)
. . . . .
I'm still getting this problem (server crash) or some of my Macs. Could not track the cause. Everything's the latest released.
All I can say that the workaround of starting VSC manually via
code .
command in the Terminal window works. But (a) it "ruins" that window because it now becomes "polluted" with the messages like$ [main 2022-03-16T17:55:36.024Z] window#load: attempt to load window (id: 1) [main 2022-03-16T17:55:36.045Z] update#setState idle [main 2022-03-16T17:55:36.328Z] ExtensionHostStarterWorker created 2022-03-16 13:55:36.905 Code Helper (Renderer)[11599:2716338] CoreText note: Client requested name ".NewYork-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:]. 2022-03-16 13:55:36.905 Code Helper (Renderer)[11599:2716338] CoreText note: Set a breakpoint on CTFontLogSystemFontNameRequest to debug. [main 2022-03-16T17:55:37.101Z] window#load: window reported ready (id: 1) [main 2022-03-16T17:55:46.048Z] Unable to resolve your shell environment in a reasonable time. Please review your shell configuration. [main 2022-03-16T17:55:46.049Z] Unable to resolve your shell environment in a reasonable time. Please review your shell configuration. [main 2022-03-16T17:55:46.049Z] RequestService#request resolving shell environment failed Error: Unable to resolve your shell environment in a reasonable time. Please review your shell configuration. at Timeout.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:67:1743) at listOnTimeout (internal/timers.js:554:17) at processTimers (internal/timers.js:497:7) [main 2022-03-16T17:55:46.082Z] Starting extension host with pid 11664 (fork() took 4 ms). [main 2022-03-16T17:55:46.082Z] ExtensionHostStarterWorker.start() took 5 ms. [main 2022-03-16T17:56:06.048Z] update#setState checking for updates [main 2022-03-16T17:56:07.090Z] update#setState idle (node:11620) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. (Use `Code Helper (Renderer) --trace-deprecation ...` to show where the warning was created) . . . . .
For your specific case if it works from the terminal, usually means VSCode isn't populating your path correctly.
Can you paste your logs when you see the error?
For your specific case if it works from the terminal, usually means VSCode isn't populating your path correctly
The thought did cross my mind. I wonder how I can alleviate this problem of path not being populated properly (this is MacOS)...?
Can you paste your logs when you see the error?
Sure. Which of the logs you think would help?
$ ll ~/Library/Application\ Support/code/logs/20220316T154455/
total 64
drwxr-xr-x 9 ur20980 staff 288 Mar 16 15:45 ./
drwxr-xr-x 12 ur20980 staff 384 Mar 16 15:45 ../
drwxr-xr-x 4 ur20980 staff 128 Mar 16 15:45 exthost1/
-rw-r--r-- 1 ur20980 staff 1212 Mar 16 15:54 main.log
drwxr-xr-x 4 ur20980 staff 128 Mar 16 15:44 output_1_20220316T154456/
-rw-r--r-- 1 ur20980 staff 14880 Mar 16 15:54 renderer1.log
-rw-r--r-- 1 ur20980 staff 221 Mar 16 15:45 sharedprocess.log
-rw-r--r-- 1 ur20980 staff 303 Mar 16 15:44 telemetry.log
-rw-r--r-- 1 ur20980 staff 187 Mar 16 15:44 userDataSync.log
For example:
$ cat ~/Library/Application\ Support/code/logs/20220316T154455/exthost1/exthost.log
[2022-03-16 15:45:06.464] [exthost] [info] Extension host with pid 18954 started
[2022-03-16 15:45:06.464] [exthost] [info] Skipping acquiring lock for /Users/ur20980/Library/Application Support/Code/User/workspaceStorage/1a8d55dc3984a39488a9464eccee1433.
[2022-03-16 15:45:06.519] [exthost] [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication, startup: false, activationEvent: 'onAuthenticationRequest:microsoft'
[2022-03-16 15:45:06.528] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: true, activationEvent: '*'
[2022-03-16 15:45:06.530] [exthost] [info] ExtensionService#_doActivateExtension vscode.git-base, startup: true, activationEvent: '*', root cause: vscode.github
[2022-03-16 15:45:06.533] [exthost] [info] ExtensionService#_doActivateExtension vscode.ipynb, startup: true, activationEvent: '*'
[2022-03-16 15:45:06.535] [exthost] [info] ExtensionService#_doActivateExtension andyyaldoo.vscode-json, startup: true, activationEvent: '*'
[2022-03-16 15:45:06.539] [exthost] [info] ExtensionService#_doActivateExtension donjayamanne.githistory, startup: true, activationEvent: '*'
[2022-03-16 15:45:06.567] [exthost] [info] ExtensionService#_doActivateExtension johnstoncode.svn-scm, startup: true, activationEvent: '*'
[2022-03-16 15:45:06.605] [exthost] [info] ExtensionService#_doActivateExtension KnisterPeter.vscode-github, startup: true, activationEvent: '*'
[2022-03-16 15:45:06.696] [exthost] [info] ExtensionService#_doActivateExtension ms-vsliveshare.vsliveshare, startup: true, activationEvent: '*', root cause: ms-vsliveshare.vsliveshare-audio
[2022-03-16 15:45:06.850] [exthost] [info] ExtensionService#_doActivateExtension ms-vsonline.vsonline, startup: true, activationEvent: '*'
[2022-03-16 15:45:06.956] [exthost] [info] ExtensionService#_doActivateExtension ndmitchell.haskell-ghcid, startup: true, activationEvent: '*'
[2022-03-16 15:45:06.958] [exthost] [info] ExtensionService#_doActivateExtension pdconsec.vscode-print, startup: true, activationEvent: '*'
[2022-03-16 15:45:07.015] [exthost] [info] ExtensionService#_doActivateExtension seunlanlege.action-buttons, startup: true, activationEvent: '*'
[2022-03-16 15:45:07.018] [exthost] [info] ExtensionService#_doActivateExtension shyykoserhiy.git-autoconfig, startup: true, activationEvent: '*'
[2022-03-16 15:45:07.022] [exthost] [info] ExtensionService#_doActivateExtension vscode-icons-team.vscode-icons, startup: true, activationEvent: '*'
[2022-03-16 15:45:07.836] [exthost] [info] ExtensionService#_doActivateExtension vscode.github-authentication, startup: false, activationEvent: 'api', root cause: ms-vsonline.vsonline
[2022-03-16 15:45:07.845] [exthost] [info] ExtensionService#_doActivateExtension vscode.git, startup: false, activationEvent: 'api', root cause: donjayamanne.githistory
[2022-03-16 15:45:07.872] [exthost] [error] Activating extension ms-vsonline.vsonline failed due to an error:
[2022-03-16 15:45:07.872] [exthost] [error] TypeError: vscode.authentication.onDidChangeAuthenticationProviders is not a function
at new VsCodeNativeAuthTokenProvider (/Users/ur20980/.vscode/extensions/ms-vsonline.vsonline-1.0.3076/src/authentication/vscodeNativeAuthTokenProvider.ts:29:31)
at new GitHubAuthentication (/Users/ur20980/.vscode/extensions/ms-vsonline.vsonline-1.0.3076/src/authentication/githubAuthentication.ts:31:9)
at PartnerContextProvider.createGitHubPartnerContextBundle (/Users/ur20980/.vscode/extensions/ms-vsonline.vsonline-1.0.3076/src/utils/partnerContextProvider.ts:316:31)
at Lazy.get value [as value] (/Users/ur20980/.vscode/extensions/ms-vsonline.vsonline-1.0.3076/src/utils/lazy.ts:7:59)
at PartnerContextProvider.setActivePartnerForAccountProvider (/Users/ur20980/.vscode/extensions/ms-vsonline.vsonline-1.0.3076/src/utils/partnerContextProvider.ts:139:53)
at PartnerContextProvider.init (/Users/ur20980/.vscode/extensions/ms-vsonline.vsonline-1.0.3076/src/utils/partnerContextProvider.ts:76:24)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at activate (/Users/ur20980/.vscode/extensions/ms-vsonline.vsonline-1.0.3076/src/extension.ts:83:5)
at async Promise.all (index 8)
at async Promise.all (index 0)
[2022-03-16 15:45:10.957] [exthost] [info] ExtensionService#_doActivateExtension vscode.github, startup: true, activationEvent: '*'
[2022-03-16 15:45:10.959] [exthost] [info] ExtensionService#_doActivateExtension ms-vsliveshare.vsliveshare-audio, startup: true, activationEvent: '*'
[2022-03-16 15:45:11.088] [exthost] [info] Eager extensions activated
[2022-03-16 15:45:11.093] [exthost] [info] ExtensionService#_doActivateExtension vscode.emmet, startup: false, activationEvent: 'onStartupFinished'
[2022-03-16 15:45:11.097] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished'
[2022-03-16 15:45:11.098] [exthost] [info] ExtensionService#_doActivateExtension dbaeumer.vscode-eslint, startup: false, activationEvent: 'onStartupFinished'
[2022-03-16 15:45:11.103] [exthost] [info] ExtensionService#_doActivateExtension eamodio.gitlens, startup: false, activationEvent: 'onStartupFinished'
[2022-03-16 15:45:11.123] [exthost] [info] ExtensionService#_doActivateExtension formulahendry.code-runner, startup: false, activationEvent: 'onStartupFinished'
[2022-03-16 15:45:11.147] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-containers, startup: false, activationEvent: 'onStartupFinished'
[2022-03-16 15:45:11.162] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-wsl, startup: false, activationEvent: 'onStartupFinished'
[2022-03-16 15:45:11.164] [exthost] [info] ExtensionService#_doActivateExtension vadimcn.vscode-lldb, startup: false, activationEvent: 'onStartupFinished'
[2022-03-16 15:45:11.168] [exthost] [info] ExtensionService#_doActivateExtension waderyan.gitblame, startup: false, activationEvent: 'onStartupFinished'
[2022-03-16 15:45:29.079] [exthost] [info] ExtensionService#_doActivateExtension justusadam.language-haskell, startup: false, activationEvent: 'onLanguage:haskell', root cause: UCL.haskelly
[2022-03-16 15:45:29.081] [exthost] [info] ExtensionService#_doActivateExtension hoovercj.haskell-linter, startup: false, activationEvent: 'onLanguage:haskell'
[2022-03-16 15:45:29.084] [exthost] [info] ExtensionService#_doActivateExtension lunaryorn.hlint, startup: false, activationEvent: 'onLanguage:haskell'
[2022-03-16 15:45:29.262] [exthost] [info] ExtensionService#_doActivateExtension MaxGabriel.brittany, startup: false, activationEvent: 'onLanguage:haskell'
[2022-03-16 15:45:29.265] [exthost] [info] ExtensionService#_doActivateExtension sergey-kintsel.haskell-formatter-vscode-extension, startup: false, activationEvent: 'onLanguage:haskell'
[2022-03-16 15:45:29.265] [exthost] [info] ExtensionService#_doActivateExtension sjurmillidahl.ormolu-vscode, startup: false, activationEvent: 'onLanguage:haskell'
[2022-03-16 15:45:29.266] [exthost] [info] ExtensionService#_doActivateExtension vigoo.stylish-haskell, startup: false, activationEvent: 'onLanguage:haskell'
[2022-03-16 15:45:29.509] [exthost] [error] Activating extension lunaryorn.hlint failed due to an error:
[2022-03-16 15:45:29.509] [exthost] [error] Error: Command failed: stack exec -- hlint --version
No compiler found, expected minor version match with ghc-9.0.2 (x86_64) (based on resolver setting in /Users/ur20980/.stack/global-project/stack.yaml).
To install the correct GHC into /Users/ur20980/.stack/programs/x86_64-osx/, try running "stack setup" or use the "--install-ghc" flag. To use your system GHC installation, run "stack config set system-ghc --global true", or use the "--system-ghc" flag.
at ChildProcess.exithandler (child_process.js:317:12)
at ChildProcess.emit (events.js:315:20)
at maybeClose (internal/child_process.js:1048:16)
at Socket.<anonymous> (internal/child_process.js:439:11)
at Socket.emit (events.js:315:20)
at Pipe.<anonymous> (net.js:673:12)
[2022-03-16 15:45:29.511] [exthost] [info] ExtensionService#_doActivateExtension dramforever.vscode-ghc-simple, startup: false, activationEvent: 'onLanguage:haskell'
[2022-03-16 15:45:29.531] [exthost] [info] ExtensionService#_doActivateExtension haskell.haskell, startup: false, activationEvent: 'onLanguage:haskell'
. . . . .
$
$
$ stack config set system-ghc --global true
/Users/ur20980/.stack/config.yaml already contained the intended configuration and remains unchanged.
$ stack exec -- hlint --version
HLint v3.3.6, (C) Neil Mitchell 2006-2021
$
I forget where VS Code assigns the path. It doesn't use the same environment as a login shell. There should be a fix floating out around there.
Based on the logs here it looks like GHC can't be found. To see the logs from HLS try either /tmp/hls.log
(I think that's MacOS path) OR go to the tasks dropdown in the output tab and select the haskell extension.
It turned out the problem was a command in ~/.bash_profile
that did something like
ssh_sock=$(lsof | grep ssh-agent | grep Listeners$ | awk '{print $NF}' | uniq)
On Mac, it takes forever (10-20 seconds, at least). Once I commented that line out (how could I miss it before?), another error disappeared - and PATH got the correct values in it. HLS no longer crashes.
Thank you!
This happened to me today, apparently I no longer had the correct version of the language language server installed for my version of ghc? ghcup install hls
solves the issue here. Super strange, thanks for the tips about the output view for the LS.
Your environment
HLS 0.9.0 Running in a stack project sandbox Hardware is a MacBookPro (2019) with macOS 11.2
Which lsp-client do you use: VSCode (HLS 0.9.0 is automatically downloaded by
Describe your project (alternative: link to the project): Fails with all my yesod projects, and the basic scaffold project generated with:
stack new nasty yesodweb/postgres
Steps to reproduce
stack new nasty yesodweb/postgres
Hopefully, this is easy to reproduce, given that the entire project can easily be generated from scaffold. However, I will attempt to narrow the conditions by stripping the project further and will post and insights as addendums.
Expected behaviour
Expected that the metadata would be built successfully and session could continue as normal
Actual behaviour
"Processing" status line message shows stepping though files but resets several times until the final failure notification is displayed and the extension is disabled due to restarts.
Include debug information
Execute in the root of your project the command
haskell-language-server --debug .
and paste the logs here:Debug output:
```Paste the logs from the lsp-client, e.g. for VS Code
LSP logs:
```