target / lorri

Your project's nix-env

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

After a nix-instantiate fails, further pings on that project are ignored

Profpatsch opened this issue · comments

Describe the bug

When your nix file contains an error (syntax or evaluation error), the project goes in a zombie state where later pings are not picked up anymore

To Reproduce
Steps to reproduce the behavior:

  1. start the daemon
  2. add an error to your shell.nix
  3. try to run lorri internal ping shell.nix after and notice that no event is printed and nothing happens

alternatively start the daemon with an already broken nix file, the same thing happens.

Lorri does not crash as far as I can see.

Expected behavior

The event loop should clearly respond to further requests, because after changing the file again it might be unbroken.

Additional context

release 1.2.0, master, NixOS 20.03

This might be what led to me having to stop lorri, go back into projects, and then finally just call lorri watch.

Having to do that makes everything feel broken even though it's not.

I want to confirm that this issue is the root cause for something I discussed @Profpatsch on IRC:

08:42 < kandinski> how can I force evaluation in a lorri project? I have an "INFO lorri has not completed an evaluation for this project yet" I can't get rid of even if 
                   I rename the .envrc file, launch the nix-shell by hand, and then re-enable the .envrc file
09:59 < Profpatsch> kandinski: usually just running `direnv allow` in the same project starts a lorri eval
09:59 < Profpatsch> Or exit the directory and enter it again
09:59 < Profpatsch> something which triggers direnv
09:59 < Profpatsch> there’s also `lorri internal ping`, but that’s more for debugging

My original hypothesis is that this was due to symlink resolution not working (this is in fact an issue with direnv and python/pipenv virtualenvs), but nope; this here known issue.

some_python_project $ journalctl --user --follow -u lorri

Sep 20 12:05:20 desire systemd[2061]: Stopping Lorri Daemon...
Sep 20 12:05:20 desire systemd[2061]: lorri.service: Succeeded.
Sep 20 12:05:20 desire systemd[2061]: Stopped Lorri Daemon.
Sep 20 12:05:20 desire systemd[2061]: Started Lorri Daemon.
Sep 20 12:05:20 desire lorri[3314]: Sep 20 12:05:20.799 INFO ready
Sep 20 12:05:20 desire lorri[3314]: Sep 20 12:05:20.837 INFO build status, message: BuildEvent(Started { nix_file: NixFile("/home/kandinski/data/work/hack/dmoisset_pyweek28/shell.nix"), reason: ProjectAdded(NixFile("/home/kandinski/data/work/hack/dmoisset_pyweek28/shell.nix")) })
Sep 20 12:05:21 desire lorri[3314]: Sep 20 12:05:21.076 INFO build status, message: BuildEvent(Failure { nix_file: NixFile("/home/kandinski/data/work/hack/dmoisset_pyweek28/shell.nix"), failure: Exit { cmd: "\"nix-instantiate\" \"-vv\" \"--add-root\" \"/tmp/.tmps4jKnr/result\" \"--indirect\" \"--argstr\" \"runTimeClosure\" \"/nix/store/am11q6h6czzvw54d8nvy8l6s6il46di6-runtime-closure.nix\" \"--argstr\" \"src\" \"/home/kandinski/data/work/hack/dmoisset_pyweek28/shell.nix\" \"--\" \"/home/kandinski/.cache/lorri/cas/3a83fbad2f114b4f4f431db2014c985c\"", status: Some(1), logs: [LogLine("trace: using storePath"), LogLine("error: cannot coerce a function to a string, at /home/kandinski/.cache/lorri/cas/3a83fbad2f114b4f4f431db2014c985c:40:7"), LogLine("(use \'--show-trace\' to show detailed location information)")] } })

## here I fix the shell.nix but nothing happens until I issue a
## $ systemctl --user restart lorri

Sep 20 12:06:34 desire systemd[2061]: Stopping Lorri Daemon...
Sep 20 12:06:34 desire systemd[2061]: lorri.service: Succeeded.
Sep 20 12:06:34 desire systemd[2061]: Stopped Lorri Daemon.
Sep 20 12:06:34 desire systemd[2061]: Started Lorri Daemon.
Sep 20 12:06:34 desire lorri[3509]: Sep 20 12:06:34.642 INFO ready
Sep 20 12:06:34 desire lorri[3509]: Sep 20 12:06:34.680 INFO build status, message: BuildEvent(Started { nix_file: NixFile("/home/kandinski/data/work/hack/dmoisset_pyweek28/shell.nix"), reason: ProjectAdded(NixFile("/home/kandinski/data/work/hack/dmoisset_pyweek28/shell.nix")) })
Sep 20 12:06:36 desire lorri[3509]: Sep 20 12:06:36.080 INFO build status, message: BuildEvent(Completed { nix_file: NixFile("/home/kandinski/data/work/hack/dmoisset_pyweek28/shell.nix"), result: BuildResults { output_paths: OutputPaths { shell_gc_root: RootPath("/home/kandinski/.cache/lorri/gc_roots/842be5c23ba1af49a7cb7fe16494a45e/gc_root/shell_gc_root") } } })

Once lorri picks up changes, it keeps working as long as I don't make breaking changes to shell.nix, so for me restarting the user-level systemd unit works.

I can no longer reproduce this issue on master, both with syntax errors and with evaluation errors.

yes, it should have been fixed by nix-community/lorri#7 in the fork.