Haskell-ide-engine: HIE type on hover dies because of specific file

Created on 10 May 2018  路  20Comments  路  Source: haskell/haskell-ide-engine

How to reproduce:

  • do a checkout of https://github.com/razvan-panda/Haskell-Book at SHA f80e738fd58be820258aed8b44e8c7cdf5c60054

  • open one of the files Ch15, Ch16 or Ch16Rearrange - type on hover will function

  • open Ch17 and hover over anything - type on hover is not working on this file or the previous files on which it worked

This bug can be reproduced both in Atom and in VSCode

info needed

Most helpful comment

Here you go (SHA:d99e9f9885f2cf2574e050cc3c535535b4e0e94e)
Anyway, thanks in advance.

All 20 comments

It dies with the following console error in Atom:

01:58:11.524 logger.ts:19 Haskell (hie) stderr hie: gfromJust initRdrNameMap Nothing
warn @ logger.ts:19
stderr.split.filter.forEach @ auto-languageclient.ts:698
handleServerStderr @ auto-languageclient.ts:698
childProcess.stderr.on @ auto-languageclient.ts:341
emitOne @ events.js:96
emit @ events.js:191
readableAddChunk @ _stream_readable.js:178
Readable.push @ _stream_readable.js:136
onread @ net.js:560
01:58:11.524 logger.ts:19 Haskell (hie) stderr CallStack (from HasCallStack):
warn @ logger.ts:19
stderr.split.filter.forEach @ auto-languageclient.ts:698
handleServerStderr @ auto-languageclient.ts:698
childProcess.stderr.on @ auto-languageclient.ts:341
emitOne @ events.js:96
emit @ events.js:191
readableAddChunk @ _stream_readable.js:178
Readable.push @ _stream_readable.js:136
onread @ net.js:560
01:58:11.524 logger.ts:19 Haskell (hie) stderr   error, called at src/Language/Haskell/GHC/ExactPrint/Utils.hs:622:27 in ghc-exactprint-0.5.6.0-E46BVefKuiy3GRzydLcKBg:Language.Haskell.GHC.ExactPrint.Utils
warn @ logger.ts:19
stderr.split.filter.forEach @ auto-languageclient.ts:698
handleServerStderr @ auto-languageclient.ts:698
childProcess.stderr.on @ auto-languageclient.ts:341
emitOne @ events.js:96
emit @ events.js:191
readableAddChunk @ _stream_readable.js:178
Readable.push @ _stream_readable.js:136
onread @ net.js:560

This was happening when the Ch17.hs file content was:

{-# LANGUAGE InstanceSigs #-}

module Ch17 where

import           Control.Applicative
import           Data.List
import           Data.Monoid

Getting a different error now (playing around with divide and conquer on the file). It appears it dies on bad classify pragma:

02:11:01.160 logger.ts:19 Haskell (hie) stderr /run/user/1000/ghc-mod22759/Ch1722758-2.hs:9:9: Error while reading hi
warn @ logger.ts:19
stderr.split.filter.forEach @ auto-languageclient.ts:698
handleServerStderr @ auto-languageclient.ts:698
childProcess.stderr.on @ auto-languageclient.ts:341
emitOne @ events.js:96
emit @ events.js:191
readableAddChunk @ _stream_readable.js:178
Readable.push @ _stream_readable.js:136
onread @ net.js:560
02:11:01.236 logger.ts:19 Haskell (hie) stderr nt file, bad classify pragma
warn @ logger.ts:19
stderr.split.filter.forEach @ auto-languageclient.ts:698
handleServerStderr @ auto-languageclient.ts:698
childProcess.stderr.on @ auto-languageclient.ts:341
emitOne @ events.js:96
emit @ events.js:191
readableAddChunk @ _stream_readable.js:178
Readable.push @ _stream_readable.js:136
onread @ net.js:560
02:11:01.236 logger.ts:19 Haskell (hie) stderr module "HLint: Move brackets to avoid $"
warn @ logger.ts:19
stderr.split.filter.forEach @ auto-languageclient.ts:698
handleServerStderr @ auto-languageclient.ts:698
childProcess.stderr.on @ auto-languageclient.ts:341
emitOne @ events.js:96
emit @ events.js:191
readableAddChunk @ _stream_readable.js:178
Readable.push @ _stream_readable.js:136
onread @ net.js:560
02:11:01.236 logger.ts:19 Haskell (hie) stderr hie: ExitFailure 1
warn @ logger.ts:19
stderr.split.filter.forEach @ auto-languageclient.ts:698
handleServerStderr @ auto-languageclient.ts:698
childProcess.stderr.on @ auto-languageclient.ts:341
emitOne @ events.js:96
emit @ events.js:191
readableAddChunk @ _stream_readable.js:178
Readable.push @ _stream_readable.js:136
onread @ net.js:560

Removing the invalid classify pragma fixed the issue. Not sure what further actions should be taken regarding this ticket, but it was very confusing as to why it was not working.

Just having:

{-# LANGUAGE InstanceSigs #-}

module Ch17 where

in the file was also killing HIE.

We now have better exception handling in hie.

Does the original problem still occur with current master?

I'm testing on NixOS and run into following issue when updating HIE to latest version: https://github.com/domenkozar/hie-nix/issues/13

I know @domenkozar said something about the update getting more complicated because hie now uses submodules.

I am not sure if that repo deals with them properly yet.

@alanz Still having the same issues with HIE a4e21f43c94dfc253d07614e781347d657c86b9b

The problem still occurs.
In my case, It happens occasionally when i tried to copy a code and then paste into the editor(VSCode). Not sure whether problem came from HIE itself or a language server extension.

hie-bug

here鈥檚 some part of logs i think it鈥檚 informative

... blah blah
hie: gfromJust initRdrNameMap Nothing
CallStack (from HasCallStack):
  error, called at src/Language/Haskell/GHC/ExactPrint/Utils.hs:622:27 in ghc-exactprint-0.5.6.1-JGvkCVQspir2AFrA6YrhNv:Language.Haskell.GHC.ExactPrint.Utils

Can you provide the rest of the callstack?

@alanz okay. This isn鈥檛 the same file as above but still reproduces the same problem.

hie-bug2

hie-bug3

hie-bug4

Can you make the project available (or a subset of it) so we can test locally?

Here you go (SHA:d99e9f9885f2cf2574e050cc3c535535b4e0e94e)
Anyway, thanks in advance.

Love it: learned haskell, caught my annoying bug :)

@domenkozar explain?

@krikchaip Are you running this on nix? I am unable to reproduce the problem,

@alanz errr... never heard any of nix term before, sorry 馃槙
In answer, I run it on OSX 10.13.6

I also get a similar error, with Spacemacs (latest develop) and latest master HIE
(in the lsp-haskell log):

hie: gfromJust initRdrNameMap Nothing
CallStack (from HasCallStack):
  error, called at src/Language/Haskell/GHC/ExactPrint/Utils.hs:624:27 in ghc-exactprint-0.5.8.1-IvDIVerdDiI67LGxeYpMLd:Language.Haskell.GHC.ExactPrint.Utils

It would be helpful if anyone having this error could compile hie with profiling exanbled and try to reproduce the error to get the full stack trace:

Compile with profiling:

stack install --work-dir=.stack-work-profile --profile

This will take quite a while to compile. Then set your editor to pass extra opts to hie. The command should be something like this:

/path/to/hie +RTS -xc

I've attached a stack trace here: https://gist.github.com/nitros12/83e3613ed3796e113a52665c88e7e3f8

So far I've had hie crash when hovering and also after completions are requested a second time.

We have to check those cases with latest master

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alanz picture alanz  路  3Comments

IvanMalison picture IvanMalison  路  5Comments

alanz picture alanz  路  3Comments

alanz picture alanz  路  3Comments

rvion picture rvion  路  3Comments