commercialhaskell / stack-ide

Stack-based JSON interface to ide-backend
98 stars 23 forks source link

stack-ide consume request without waiting for new lines, and crash at various input #86

Closed rvion closed 8 years ago

rvion commented 8 years ago

followup of https://github.com/commercialhaskell/stack-ide/issues/81

The 2 problems I see are

when I start stack ide from terminal

$ stack ide start ride
{"tag":"ResponseWelcome","contents":[0,1,1]}
{"tag":"ResponseLog","contents":"[Info] Initializing ide-backend session @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.Update ./IdeSession/Update.hs:195:3)\n"}
{"tag":"ResponseLog","contents":"[Debug] Session dir = /Users/RemiVion/dev/ride/session.98045 @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.Update ./IdeSession/Update.hs:208:3)\n"}
{"tag":"ResponseLog","contents":"[Debug] Dist dir = /Users/RemiVion/dev/ride/.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/ @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.Update ./IdeSession/Update.hs:210:3)\n"}
{"tag":"ResponseLog","contents":"[Debug] Local working dir = /Users/RemiVion/dev/ride/ @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.Update ./IdeSession/Update.hs:217:17)\n"}
{"tag":"ResponseLog","contents":"[Info] Searching for ide-backend-server on this path: /Users/RemiVion/dev/ride/.stack-work/install/x86_64-osx/lts-3.4/7.10.2/bin/:/Users/RemiVion/.stack/snapshots/x86_64-osx/lts-3.4/7.10.2/bin/:/Users/RemiVion/dev/neo4j-community-2.2.5/bin:/Users/RemiVion/.local/bin:/Users/RemiVion/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.RPC.Client ./IdeSession/RPC/Client.hs:341:5)\n"}
{"tag":"ResponseLog","contents":"[Info] Found ide-backend-server - using this one: /Users/RemiVion/.local/bin/ide-backend-server @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.RPC.Client ./IdeSession/RPC/Client.hs:343:5)\n"}
{"tag":"ResponseLog","contents":"[Debug] Recompile required, starting... @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.Update.ExecuteSessionUpdate ./IdeSession/Update/ExecuteSessionUpdate.hs:223:5)\n"}

Then, at the very moment I finish typing {"tag": "RequestUpdateSession", "contents": []}, right after I typed the last }, without pressing enter, I get the rensponse from stack:

{"tag": "RequestUpdateSession", "contents": []}{"tag":"ResponseLog","contents":"[Debug] Recompile required, starting... @(ideba_HqZKAqZV4wa5sqhSD7XjZv:IdeSession.Update.ExecuteSessionUpdate ./IdeSession/Update/ExecuteSessionUpdate.hs:223:5)\n"}
{"tag":"ResponseUpdateSession","contents":{"tag":"UpdateStatusDone","contents":[]}}

when I type some specific chars (even when not pressing enter) stack-ide crash eg:

[[A{"tag":"ResponseFatalError","contents":"user error (Failed reading: satisfy)"}
Process exited with ExitFailure 1: /Users/RemiVion/.local/bin/stack-ide --verbose --include=/Users/RemiVion/dev/ride/:/Users/RemiVion/dev/ride/src/:/Users/RemiVion/dev/ride/.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/autogen/:/Users/RemiVion/dev/ride/.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/ --local-work-dir=/Users/RemiVion/dev/ride/ --ide-backend-tools-path=/Users/RemiVion/dev/ride/.stack-work/install/x86_64-osx/lts-3.4/7.10.2/bin/:/Users/RemiVion/.stack/snapshots/x86_64-osx/lts-3.4/7.10.2/bin/:/Users/RemiVion/dev/neo4j-community-2.2.5/bin:/Users/RemiVion/.local/bin:/Users/RemiVion/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin --dist-dir=/Users/RemiVion/dev/ride/.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/ --ghc-option=-hide-all-packages --ghc-option=-i/Users/RemiVion/dev/ride/ --ghc-option=-i/Users/RemiVion/dev/ride/src/ --ghc-option=-i/Users/RemiVion/dev/ride/.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/autogen/ --ghc-option=-i/Users/RemiVion/dev/ride/.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/ --ghc-option=-stubdir=/Users/RemiVion/dev/ride/.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/ --ghc-option=-optP-include --ghc-option=-optP/Users/RemiVion/dev/ride/.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/autogen/cabal_macros.h --ghc-option=-package=base --ghc-option=-package=transformers-0.4.2.0 --ghc-option=-package=lens-4.12.3 --ghc-option=-package=containers-0.5.6.2 --ghc-option=-package=text-1.2.1.3 --ghc-option=-package=Spock-0.8.1.0 --ghc-option=-package=wai-middleware-static-0.7.0.1 --ghc-option=-package=wai-extra-3.0.10 --ghc-option=-package=aeson-0.8.0.2 --ghc-option=-package=process-1.2.3.0 --ghc-option=-package=filemanip-0.3.6.3 --package-db=/Users/RemiVion/.stack/snapshots/x86_64-osx/lts-3.4/7.10.2/pkgdb/:/Users/RemiVion/dev/ride/.stack-work/install/x86_64-osx/lts-3.4/7.10.2/pkgdb/

it also seems to happen when stdin is not a tty under some other circumstances, eg: when stack-ide is started by sublime-stack-ide (related bug: https://github.com/lukexi/stack-ide-sublime/issues/17)

chrisdone commented 8 years ago

Does this happen in the IDE or just when you manually mess with it? The former case is important, the latter not so much.

rvion commented 8 years ago

it happens with both

rvion commented 8 years ago

updated to the latest 1.5 stack binary release, it's all working now. Not quite sure to understand, but cool ending