lorri icon indicating copy to clipboard operation
lorri copied to clipboard

Crash Report

Open Randy1Burrell opened this issue 1 year ago • 14 comments

Describe the bug

lorri watch produces error

To Reproduce Steps to reproduce the behavior:

  1. run lorri watch

Expected behavior

Expected the program to work.

Metadata

name = 'lorri'
operating_system = 'unix:OSX'
crate_version = '1.6.0'
explanation = '''
Panic occurred in file 'src/build_loop.rs' at line 238
'''
cause = '''
Unrecoverable error:
Io {
    msg: "AddRootError { source: Os { code: 13, kind: PermissionDenied, message: \"Permission denied\" }, msg: \"Failed to create missing nix user gc directory: /nix/var/nix/gcroots/per-user/randyburrell\" }",
}'''
method = 'Panic'
backtrace = '''

   0: 0x10e1958c3 - <unresolved>
   1: 0x10dff821e - <unresolved>
   2: 0x10df93077 - <unresolved>
   3: 0x10dfb4643 - <unresolved>
   4: 0x10e14a0e9 - <unresolved>
   5: 0x7ff80279f1d3 - __pthread_start'''
$ lorri info
GC roots exist, shell_gc_root: /Users/randyburrell/Library/Caches/com.github.nix-community.lorri.lorri.lorri/gc_roots/51c71c0c68ac338ce2c335cdd203134c/gc_root/shell_gc_root
$ uname -a
Darwin Randys-MacBook-Pro.local 22.5.0 Darwin Kernel Version 22.5.0: Mon Apr 24 20:51:50 PDT 2023; root:xnu-8796.121.2~5/RELEASE_X86_64 x86_64 i386 Darwin

Additional context

Randy1Burrell avatar Jul 14 '23 23:07 Randy1Burrell

Thanks for the report

nyarly avatar Jul 14 '23 23:07 nyarly

@nyarly do you have any idea what could be the possible fix? lorri is not updating my shell or environment whenever I change my nix config file.

I have darwin running and this is the shell output for launchctl list | grep nix

2597    0       org.nixos.lorri

darwin-configuration

{ config, pkgs, ... }:

{
  imports = [ ./lorri.nix ];
  # List packages installed in system profile. To search by name, run:
  # $ nix-env -qaP | grep wget
  environment.systemPackages =
    [ pkgs.vim
    ];

  # Use a custom configuration.nix location.
  # $ darwin-rebuild switch -I darwin-config=$HOME/.config/nixpkgs/darwin/configuration.nix
  # environment.darwinConfig = "$HOME/.config/nixpkgs/darwin/configuration.nix";

  # Auto upgrade nix package and the daemon service.
  services.nix-daemon.enable = true;
  # nix.package = pkgs.nix;

  # Create /etc/zshrc that loads the nix-darwin environment.
  programs.zsh.enable = true;  # default shell on catalina
  # programs.fish.enable = true;

  # Used for backwards compatibility, please read the changelog before changing.
  # $ darwin-rebuild changelog
  system.stateVersion = 4;
}

lorri.nix

{ config, pkgs, ... }:

let
  inherit (pkgs) lorri;

in {
  environment.systemPackages = [ lorri ];
  launchd.user.agents = {
    "lorri" = {
      serviceConfig = {
        WorkingDirectory = (builtins.getEnv "HOME");
        EnvironmentVariables = { };
        KeepAlive = true;
        RunAtLoad = true;
        StandardOutPath = "/var/tmp/lorri.log";
        StandardErrorPath = "/var/tmp/lorri.log";
      };
      script = ''
        source ${config.system.build.setEnvironment}
        exec ${lorri}/bin/lorri daemon
      '';
    };
  };
}

Randy1Burrell avatar Jul 15 '23 15:07 Randy1Burrell

That's a good question - I'll see how much help I can be. I'm less experienced with the Darwin environment.

Lorri wants to create a GC root for your project, and passes commands to Nix to do so. The error you're getting suggests there's a permissions issue creating the root at /nix/var/nix/gcroots/per-user/randyburrell - that may all be incredibly obvious already, but just establishing the root cause.

I'd check to see that nix-shell works with the project, and see what the permissions are on that directory - if it exists, even.

Lorri ought to have a better approach to handling this issue. We'd need to look into particulars about what it could do, though.

nyarly avatar Jul 15 '23 20:07 nyarly

I'm seeing this same error every time I do a 'lorri watch', running on Windows/WSL2. I've included the toml file as text since github won't let me attach a TOML file. The original file name was "/tmp/report-2a9e5838-6784-43c0-92f0-e39b7ea898ca.toml".

name = 'lorri'
operating_system = 'unix:Ubuntu'
crate_version = '1.6.0'
explanation = '''
Panic occurred in file 'src/build_loop.rs' at line 238
'''
cause = '''
Unrecoverable error:
Io {
    msg: "AddRootError { source: Os { code: 13, kind: PermissionDenied, message: \"Permission denied\" }, msg: \"Failed to create missing nix user gc directory: /nix/var/nix/gcroots/per-user/ashebanow\" }",
}'''
method = 'Panic'
backtrace = '''

   0: 0x55b51245e2b6 - lorri::build_loop::BuildLoop::forever::h6bd3eba14169990d
   1: 0x55b512420e68 - std::panicking::try::h142838059837ff89
   2: 0x55b5124109f2 - std::sys_common::backtrace::__rust_begin_short_backtrace::h6f298be63434d7f3
   3: 0x55b512483809 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h7d1f44b2c36cceed
   4: 0x55b5125c5703 - std::sys::unix::thread::Thread::new::thread_start::h4514580219a899c5
   5: 0x7f979bd10e64 - start_thread
   6: 0x7f979bd929f0 - __GI___clone3
   7:        0x0 - <unresolved>'''

ashebanow avatar Nov 16 '23 23:11 ashebanow

Oh, and I should add that manually creating the directory (as root) changes the error to:

Failed to symlink /home/ashebanow/.cache/lorri/gc_roots/3aada8720869adbdbdd99445d6f72682/gc_root/shell_gc_root to /nix/var/nix/gcroots/per-user/ashebanow/3aada8720869adbdbdd99445d6f72682-shell_gc_root

I then tried changing the owner of /nix/var/nix/gcroots/per-user/ashebanow to be ashebanow, and everything works.

ashebanow avatar Nov 16 '23 23:11 ashebanow

I decided to use another solution since lorri doesn't work for me

Randy1Burrell avatar Nov 17 '23 01:11 Randy1Burrell

@nyarly Out of curiosity, was the bug actually fixed? If so, can you point me at the commit? I'm always interested in seeing how rust handles such situations.

ashebanow avatar Feb 20 '24 19:02 ashebanow

No - I closed it prematurely based on Randy's departure. I'll need to be able to characterize the issue better before I could work on it (although a PR would be appreciated.)

Missing per-user GC roots strikes me as something that needs consideration: in a working Nix system (even a per-user install), those directories should already exist. I'm not sure how you'd've installed Lorri in the first place without that?

nyarly avatar Feb 20 '24 20:02 nyarly

I am facing the same issue and found some possible explanation here: https://github.com/NixOS/nix/issues/8564#issuecomment-1932315668.

frprm avatar Mar 27 '24 09:03 frprm

facing probably the same thing, here is the crash report, I am going to try to see what I can do to fix it locally first

name = 'lorri'
operating_system = 'unix:Unknown'
crate_version = '1.6.0'
explanation = '''
Panic occurred in file 'src/build_loop.rs' at line 238
'''
cause = '''
Unrecoverable error:
Io {
    msg: "AddRootError { source: Os { code: 13, kind: PermissionDenied, message: \"Permission denied\" }, msg: \"Failed to create missing nix user gc directory: /nix/var/nix/gcroots/per-user/dianao\" }",
}'''
method = 'Panic'
backtrace = '''

   0: 0x564b4927f921 - lorri::build_loop::BuildLoop::forever::h94bef58eeed4c3e7
   1: 0x564b492779f7 - std::sys_common::backtrace::__rust_begin_short_backtrace::he06bfefd46870e6b
   2: 0x564b49295622 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h1a6233b6a69fd0c2
   3: 0x564b493e7a45 - std::sys::unix::thread::Thread::new::thread_start::hdf0ce3dbe0807413
   4: 0x7f699622f383 - start_thread
   5: 0x7f69962b200c - __clone3
   6:        0x0 - <unresolved>'''

DianaOlympos avatar Mar 27 '24 11:03 DianaOlympos

For the time being, I created my own directory in per-user with my {user} and chowned it to my user. This seems to solve it for now, but it is definitely not elegant :smile:

DianaOlympos avatar Mar 27 '24 11:03 DianaOlympos

I'm actively working on fixing this issue in particular. It appears to be a change made in the Nix installer at some point, and I'm figuring out how best to approach gcroots now.

nyarly avatar Mar 29 '24 20:03 nyarly

For the time being, @DianaOlympos has the right idea: create the per-user/$user directory manually. We'll have a real fix out soon.

nyarly avatar Mar 29 '24 20:03 nyarly

For the time being, @DianaOlympos has the right idea: create the per-user/$user directory manually. We'll have a real fix out soon.

Oh sure, give Diana all the credit, even though I said the same thing in this thread four months earlier ;-)

In all seriousness, though, really happy to hear a fix is in the works. Thanks!

ashebanow avatar Mar 29 '24 20:03 ashebanow

c.f. https://github.com/nix-community/lorri/issues/119#issuecomment-2195297067

nyarly avatar Jun 27 '24 17:06 nyarly

This bug is fixed in 1.7.0, which is in nixpkgs as of NixOS 24.05. Thank you for your patience!

nyarly avatar Jul 19 '24 21:07 nyarly