Haskell Repls: ghci crashes often

Problem description:

Since yesterday in all of my Haskell repls ghci tends to crash, in the console and in the shell:

I’ve been using Haskell repls a lot over the last few weeks and this has never happened before yesterday. I’ve deleted all the repls and started them fresh (uploading the files) but this hasn’t changed anything.

Expected behavior:

No ghci crash.

Actual behavior:

ghci chrashes often, in the console as well as the shell.

Steps to reproduce:

I don’t know how to reproduce this, maybe look into my repls.

Bug appears at this link:

Browser: Safari & Firefox
OS: MacOS, Windows
Plan: Teams Pro

Same thing here for me and my Repl.it Education Teams.
I’ve noticed the Console holds the prompt after crashing and is able to :load a file.
Using runhaskell in the Shell also works, but ghci in the Shell is mostly useless as it crashes too often.

This may be related to this issue reported in haskell.org:
https://discourse.haskell.org/t/facing-mmap-4096-bytes-at-nil-cannot-allocate-memory-youre-not-alone/6259/3

1 Like

Thanks! Yes, looks a lot like that’s the underlying cause. Not clear, why it only started a couple of days ago (at least for me).

I usually get ghci to work after a couple of tries. But it’s annoying.

I’ve just tried this workaround based on https://discourse.haskell.org/t/facing-mmap-4096-bytes-at-nil-cannot-allocate-memory-youre-not-alone/6259/21:

In the Shell, start ghci as: ghci +RTS -xp -RTS

It seems to work. So far I haven’t noticed the error anymore.

@AndreaSchwertne Yes, that looks like it works.

Another solution might be to switch to the latest stable Nix channel: I’ve modified the nix section in the .replit file to

[nix]
channel = "stable-23_05"

and so far it seems to work (it updates ghc to version 9.2.8 in which the bug is fixed).

1 Like

That’s a lot better! I tried it here and it seems to work too. Thanks!

1 Like

@AndreaSchwertne It takes a while to load the Nix environment when the repl is started but it seems okay. Thanks again for your input!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.