Skip to content

The case of the mysterious segfault loop #2314

Closed
@GavinRay97

Description

@GavinRay97

I do not know anything about/write Haskell, but I have been trying to make the tooling and experience better for contributors and folks on our team.

Part of our Codebase is in Haskell. I wrote a development Dockerfile that reproducibly creates an environment with needed deps for our Haskell app -- but I am unable to get HLS to function properly in it ☹️

Probably user error, but taking an informal poll shows:

  • Approx ~30% of our Haskell devs are unable to get HLS working
  • 100% of devs who responded said they use or would like to use HLS, if it worked
  • Trend appears to be that those who have issues are running Linux. Mac/OSx users don't report trouble.
CLICK TO SHOW IMAGE 👇

image

What happens is that it builds, and then gets stuck in a segfault loop.

To make this easy to reproduce, I've containerized everything -- you should be able to open it in your browser or use a VS Code Devcontainer locally to get an identical environment to the one that is broken.

Your environment

Output of haskell-language-server --probe-tools or haskell-language-server-wrapper --probe-tools:

@GavinRay97 ➜ /workspaces/graphql-engine (master ✗) $ ~/.ghcup/bin/haskell-language-server-wrapper --probe-tools
haskell-language-server version: 1.4.0.0 (GHC: 8.10.4) (PATH: /home/codespace/.ghcup/bin/haskell-language-server-wrapper-1.4.0) (GIT hash: 253547816ee216c53ee7dacc0ad3cac43e863d30)
Tool versions found on the $PATH
cabal:          3.6.2.0
stack:          Not found
ghc:            8.10.2

Which OS do you use:

Which lsp-client do you use:

  • VS Code

Describe your project (alternative: link to the project):


Steps to reproduce

CLICK TO SHOW INSTRUCTIONS 👇

Without VS Code or Codespaces at all

  • Use the Dockerfile at .devcontainer/Dockerfile
  • Set up a bind mount over /graphql-engine, and run the Docker image (either manually or with Compose)

In a browser

  1. Go here: https://github.com/GavinRay97/graphql-engine
  2. Press "New Codespace", as in image below

image

In VS Code locally/offline

In VS Code locally, but connected to a remote Codespace ("Thin Client")

  • Install the Codespaces extension in VS Code
  • On the navigation panel thing, click the Remote Explorer icon (circled in red), then from the dropdown at the top (circled in red) select Codespaces, and either press + to create a new one or click to connect to an existing:
    • image

In a text editor like vim, emacs, etc, connected to remote Codespace ("Thin client"):**

Expected behaviour

It doesn't segfault, or instead of segfaulting it prints helpful debug info before dying (I have tried turning verbose logging on, no dice 🙁)

Actual behaviour

It starts, segfaults at random (no pattern), and restarts itself, repeating the loop.

Include debug information

Execute in the root of your project the command haskell-language-server --debug . and paste the logs here:

Debug output:
<paste your logs here>

Paste the logs from the lsp-client, e.g. for VS Code

LSP logs:
<paste your logs here>

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions