Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doctests hang when compiling with nix #15

Closed
cdepillabout opened this issue Aug 26, 2018 · 9 comments
Closed

doctests hang when compiling with nix #15

cdepillabout opened this issue Aug 26, 2018 · 9 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@cdepillabout
Copy link
Owner

The doctests for termonad appear to hang when compiling with nix-build. Because of this I have disabled them in the termonad.nix file.

Here is what it looks like when running nix-build:

$ cd termonad/
$ nix-build
...
Running 2 test suites...
Test suite termonad-test: RUNNING...
Test suite termonad-test: PASS
Test suite logged to: dist/test/termonad-0.2.1.0-termonad-test.log
Test suite doctests: RUNNING...

It just hangs here. doctest appears to fork multiple threads and use 100% of the CPU, but nothing seems to happen.

The doctests work when run with stack, even on NixOS.

@cdepillabout cdepillabout added bug Something isn't working help wanted Extra attention is needed labels Aug 26, 2018
cdepillabout added a commit to cdepillabout/nixpkgs that referenced this issue Sep 3, 2018
…te-packages.

The doctests for termonad fail to build only with nix.  When building
without nix, the doctests run correctly:

cdepillabout/termonad#15

This PR disables the tests for termonad, as well as removing it from
dont-distribute-packages.
peti pushed a commit to NixOS/nixpkgs that referenced this issue Sep 3, 2018
…te-packages.

The doctests for termonad fail to build only with nix.  When building
without nix, the doctests run correctly:

cdepillabout/termonad#15

This PR disables the tests for termonad, as well as removing it from
dont-distribute-packages.
peti pushed a commit to NixOS/nixpkgs that referenced this issue Sep 12, 2018
…te-packages.

The doctests for termonad fail to build only with nix.  When building
without nix, the doctests run correctly:

cdepillabout/termonad#15

This PR disables the tests for termonad, as well as removing it from
dont-distribute-packages.
@cdepillabout
Copy link
Owner Author

cdepillabout commented Mar 20, 2019

I wonder if this is related to sol/doctest#219. (edit: this does not seem to be related)

@cdepillabout
Copy link
Owner Author

I've figured out that this seems to be caused the by the configure options declared in the generic Haskell builder:

https://github.com/NixOS/nixpkgs/blob/d73f16d6767e99675682f822dac3017bf9af1e83/pkgs/development/haskell-modules/generic-builder.nix#L151-L166

Commenting out all those options appears to make the doctests succeed in just a minute or two. I'm currently trying to figure out which option is to blame.

@cdepillabout
Copy link
Owner Author

I figured this out and posted sent a PR about it upstream:

NixOS/nixpkgs#58743

@cdepillabout
Copy link
Owner Author

This appears to be the corresponding GHC issue:

https://gitlab.haskell.org/ghc/ghc/issues/15524#note_193060

@cdepillabout
Copy link
Owner Author

I finally fixed this in #113.

@n4074
Copy link

n4074 commented Oct 8, 2019

I'm encountering this issue while trying to build the latest version of Termonad on Nixos 19.03, with the following Nixos configuration:

{ config, pkgs, ... }:
let
  termonad = builtins.fetchGit {
    url = "https://github.com/cdepillabout/termonad";
    ref = "master";
  };
in
{
  environment.systemPackages = with pkgs; [
    (import "${termonad}/.nix-helpers/termonad-with-packages.nix" { })
  ];
}

As described, the doctest run takes 100% and eventually gets OOM-killed. For now I'm bypassing the issue by disabling tests:

{ config, pkgs, ... }:
let
  termonad = builtins.fetchGit {
    url = "https://github.com/cdepillabout/termonad";
    ref = "master";
  };

  additionalOverlays = [
    (self: super: {
      haskell = super.haskell // {
        packageOverrides = hself: hsuper:
          super.haskell.packageOverrides hself hsuper // {
            termonad = self.haskell.lib.dontCheck hsuper.termonad;
          };
      };
    })
  ];
in
{
  environment.systemPackages = with pkgs; [
    (import "${termonad}/.nix-helpers/termonad-with-packages.nix" { inherit additionalOverlays; })
  ];
}

Is this expected? Is the fix you referenced only applicable for 19.09? Thanks.

@cdepillabout
Copy link
Owner Author

cdepillabout commented Oct 8, 2019

@n4074 Thanks for this report.

However, I just tried compiling this and running the doctests at the current HEAD of master, and it appears that the doctests finish within a minute or so.

{ config, pkgs, ... }:
let termonad = builtins.fetchGit { url = "https://github.com/cdepillabout/termonad"; ref = "master"; }; in {
  environment.systemPackages = with pkgs; [ (import "${termonad}/.nix-helpers/termonad-with-packages.nix" { }) ];
}

In this setup, you are basically pulling the termonad executable from how it is defined in this repo. So since the doctests run fast on my machine, I am very surprised that they take a long time on your machine, since all the inputs to the termonad derivation should be the same.

I'm not sure what could be causing any difference here.

However, if you can't figure out what could be going on, maybe you'd like to send a PR adding a top-level option to default.nix (and .nix-helpers/termonad-with-packages.nix) to disable running tests? That should at least let you work around the problem a little easier.

@cdepillabout
Copy link
Owner Author

Another thing you could try doing is just getting termonad from a recent release of nixpkgs.

Here is nixpkgs-unstable as of today:

$ cd /some/path/to/nixpkgs
$ git checkout master
$ git pull
$ nix repl ./.
> termonad-with-packages   
«derivation /nix/store/gnil59dy229r729g6x8izzl9hsa4pml0-termonad-with-packages-8.6.5.drv»
> haskellPackages.termonad
«derivation /nix/store/99py0xvjjpgdcgj03ks160kyfd7mp266-termonad-2.0.0.0.drv»

The top-level termonad-with-packages is already using termonad-2.0.0.0, which is the latest release.

@n4074
Copy link

n4074 commented Oct 13, 2019

Thanks for your response @cdepillabout . When I upped the RAM on the VM from 4GB to 8GB the doctests started finishing reasonably quickly. I guess it just uses a lot more memory than expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants