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

Neil completely crashes on fresh install #184

Closed
keturiosakys opened this issue Jul 4, 2023 · 24 comments
Closed

Neil completely crashes on fresh install #184

keturiosakys opened this issue Jul 4, 2023 · 24 comments

Comments

@keturiosakys
Copy link

Hey! Just trying out neil as I'm wrapping my head around Clojure tools.

I've installed it with brew on macOS 13.4.1. Immediately running neil crashes it with the following error:

CleanShot 2023-07-04 at 23 28 23@2x
@borkdude
Copy link
Contributor

borkdude commented Jul 5, 2023

I'll take a look when I have time, currently traveling. Would appreciate others taking a look.

@teodorlu
Copy link
Contributor

teodorlu commented Jul 5, 2023

@keturiosakys hey!

Do you have any other files in the folder you're running neil? Specifically, do you have a bb.edn file?

@keturiosakys
Copy link
Author

@teodorlu hey, thanks for your reply! Nope, there's a deps.edn file as I'm using that for dependencies but no bb.edn

@teodorlu
Copy link
Contributor

teodorlu commented Jul 5, 2023

Ok, cool! Let's try to fix this.

  • Can you share the content of your deps.edn file?
  • Do you get the same error if you run Neil in a different folder?

I'm asking because there might be errors in the deps.edn file. Also, perhaps I'll be able to reproduce your error. If I can reproduce, it'll be much easier for me to find a fix.

@keturiosakys
Copy link
Author

The issue appears no matter which directory I run neil in.

Here's the deps.edn file contents though:

{:paths ["src" "resources"]
 :deps {org.clojure/clojure {:mvn/version "1.11.1"}
        io.github.nextjournal/clerk {:mvn/version "0.14.919"}
        clj-http/clj-http {:mvn/version "3.12.3"}}
 :aliases
 {:run-m {:main-opts ["-m" "funda-analyzer.funda-analyzer"]}
  :run-x {:ns-default funda-analyzer.funda-analyzer
          :exec-fn greet
          :exec-args {:name "Clojure"}}}

 :build {:deps {io.github.seancorfield/build-clj
                {:git/tag "v0.6.3" :git/sha "9b8e09b"
                 :deps/root "slim"
                 :ns-default build}}
         :test {:extra-paths ["test"]
                :extra-deps {org.clojure/test.check {:mvn/version "1.1.1"}
                             io.github.cognitect-labs/test-runner
                             {:git/tag "v0.5.1" :git/sha "dfb30dd"}}}}}

@borkdude
Copy link
Contributor

borkdude commented Jul 5, 2023 via email

@keturiosakys
Copy link
Author

bb --version outputs babashka v0.8.2

I'm not sure if that's the latest as I'm seeing v1.* versions on Github but installing on brew with borkdude/brew/babashka that's the latest that I get

@borkdude
Copy link
Contributor

borkdude commented Jul 5, 2023 via email

@keturiosakys
Copy link
Author

keturiosakys commented Jul 5, 2023

Indeed that was an issue (apparently I had two bb installed that conflicted) - my bad!

I am running into another crash now, however. bb on its own works fine, but neil crashes.

I'm guessing I ended up in some sort of weird state between the installs. Will try a completely clean reinstall of bb and neil

See the stack trace below:

~/C/k/funda-analyzer main• ❱ neil
Error: Could not find or load main class clojure.main
Caused by: java.lang.ClassNotFoundException: clojure.main
----- Error --------------------------------------------------------------------
Type:     clojure.lang.ExceptionInfo
Message:
Data:     {:proc #object[java.lang.ProcessImpl 0x42dc82ba "Process[pid=45903, exitValue=1]"], :exit 1, :in #object[java.lang.ProcessBuilder$NullOutputStream 0x3e6e8737 "java.lang.ProcessBuilder$NullOutputStream@3e6e8737"], :out #object[java.lang.ProcessImpl$ProcessPipeInputStream 0x4b611413 "java.lang.ProcessImpl$ProcessPipeInputStream@4b611413"], :err #object[java.lang.ProcessBuilder$NullInputStream 0x5e8022c2 "java.lang.ProcessBuilder$NullInputStream@5e8022c2"], :prev nil, :cmd ["/Users/laurynas-fp/.asdf/shims/java" "-XX:-OmitStackTraceInFastThrow" "-classpath" "/Users/laurynas-fp/.deps.clj/1.11.1.1347/ClojureTools/clojure-tools-1.11.1.1347.jar" "clojure.main" "-m" "clojure.tools.deps.script.make-classpath2" "--config-user" "" "--config-project" "__babashka_no_deps_file__.edn" "--basis-file" "/Users/laurynas-fp/.clojure/.cpcache/158BEBBC72DF2CC48E598157BC4F6490.basis" "--cp-file" "/Users/laurynas-fp/.clojure/.cpcache/158BEBBC72DF2CC48E598157BC4F6490.cp" "--jvm-file" "/Users/laurynas-fp/.clojure/.cpcache/158BEBBC72DF2CC48E598157BC4F6490.jvm" "--main-file" "/Users/laurynas-fp/.clojure/.cpcache/158BEBBC72DF2CC48E598157BC4F6490.main" "--manifest-file" "/Users/laurynas-fp/.clojure/.cpcache/158BEBBC72DF2CC48E598157BC4F6490.manifest" "--config-data" "{:deps {borkdude/rewrite-edn {:mvn/version \"0.4.6\"}, org.babashka/spec.alpha {:git/url \"https://github.com/babashka/spec.alpha\", :git/sha \"1a841c4cc1d4f6dab7505a98ed2d532dd9d56b78\"}, io.github.seancorfield/deps-new {:git/url \"https://github.com/seancorfield/deps-new\", :git/tag \"v0.5.0\", :git/sha \"48bf01e\"}, org.babashka/cli {:mvn/version \"0.6.45\"}, version-clj/version-clj {:mvn/version \"2.0.2\"}, org.babashka/http-client {:mvn/version \"0.1.4\"}}, :aliases {:org.babashka/defaults {:replace-paths [], :classpath-overrides {org.clojure/clojure \"\", org.clojure/spec.alpha \"\", org.clojure/core.specs.alpha \"\"}}}}" "-A::org.babashka/defaults"], :type :babashka.process/error}
Location: /opt/homebrew/bin/neil:8:1

----- Context ------------------------------------------------------------------
 4: ;; DO NOT EDIT DIRECTLY. GENERATED FROM scr/babashka/neil.clj
 5:
 6: (require '[babashka.deps :as deps])
 7:
 8: (deps/add-deps '{:deps {borkdude/rewrite-edn {:mvn/version "0.4.6"}
    ^---
 9:                         org.babashka/spec.alpha {:git/url "https://github.com/babashka/spec.alpha"
10:                                                  :git/sha "1a841c4cc1d4f6dab7505a98ed2d532dd9d56b78"}
11:                         io.github.seancorfield/deps-new {:git/url "https://github.com/seancorfield/deps-new"
12:                                                          :git/tag "v0.5.0"
13:                                                          :git/sha "48bf01e"}

----- Stack trace --------------------------------------------------------------
babashka.process/check                          - <built-in>
babashka.process/shell                          - <built-in>
babashka.impl.deps/add-deps/fn--27048           - <built-in>
borkdude.deps/-main                             - <built-in>
clojure.core/apply                              - <built-in>
... (run with --debug to see elided elements)
clojure.core/apply                              - <built-in>
clojure.core/with-bindings*                     - <built-in>
babashka.impl.deps/add-deps/fn--27055           - <built-in>
babashka.impl.deps/add-deps                     - <built-in>
user                                            - /opt/homebrew/bin/neil:8:1

@borkdude
Copy link
Contributor

borkdude commented Jul 5, 2023 via email

@borkdude
Copy link
Contributor

borkdude commented Jul 5, 2023 via email

@keturiosakys
Copy link
Author

No dice :( I removed/reinstalled both and tried with deleting .clojure/.cpcache as well

@borkdude
Copy link
Contributor

borkdude commented Jul 5, 2023 via email

@keturiosakys
Copy link
Author

oh apologies, missed the instructions regarding .deps.clj. Deleting that and rerunning neil has worked!

I diff'ed my corrupt .deps.clj I backed up and the new one and it seems that the former was missing example-deps.edn and tools.edn files that I imagine caused the errors. The corrupt version also had an unexpanded but corrupt tools.zip archive.

Not exactly sure why the installation got corrupted, but the issue is now resolved.

Thanks a lot for your help!

@borkdude
Copy link
Contributor

borkdude commented Jul 5, 2023 via email

@keturiosakys
Copy link
Author

Sure! The zipped file was too big for GitHub (25mb limit) so here's a link for download: https://we.tl/t-Omzy3FDYii

@borkdude
Copy link
Contributor

borkdude commented Jul 5, 2023 via email

@borkdude
Copy link
Contributor

borkdude commented Jul 5, 2023

@keturiosakys Could it be that upon the first time that bb tried to download deps.clj's tools jar, you aborted the operation midway?

You should also have seen something like:

CRC check failed when unzipping zip-file /Users/borkdude/.deps.clj/1.11.1.1347/ClojureTools/tools.zip, entry: ClojureTools/exec.jar
The tools zip file may have not been succesfully downloaded.nPlease report this problem and keep a backup of the tools zip file as a repro.nYou can try again by removing the $HOME/.deps.clj folder.
C

in babashka v1.3.181. What version are you using right now?

@keturiosakys
Copy link
Author

keturiosakys commented Jul 5, 2023

I'm on the same version of babashka currently babashka v1.3.181.

And yep I think I can confirm it was an interrupted operation. I queried my shell history for commands that ended with 130 (interrupted) exit code and it appears I ran neil bb, which was the first run of neil after re-downloading, and then for some reason cancelled the run immediately.

CleanShot 2023-07-05 at 23 21 34@2x

@borkdude
Copy link
Contributor

borkdude commented Jul 5, 2023 via email

@sg-qwt
Copy link

sg-qwt commented Sep 30, 2023

Also today I found neil from Nixpkgs is broken as well. NixOS/nixpkgs#258132

I don't know why neil is trying to fetch clojure tools from internet. Is there ways to disable the downloading behavior and add dependencies statically?

@borkdude
Copy link
Contributor

We can make neil more robust by not fetching dependencies at runtime, this means we'll have to distribute it as an uberjar.

Currently some neil dependencies are fetched on the first run:

neil/neil

Lines 8 to 16 in d76462a

(deps/add-deps '{:deps {borkdude/rewrite-edn {:mvn/version "0.4.6"}
org.babashka/spec.alpha {:git/url "https://github.com/babashka/spec.alpha"
:git/sha "1a841c4cc1d4f6dab7505a98ed2d532dd9d56b78"}
io.github.seancorfield/deps-new {:git/url "https://github.com/seancorfield/deps-new"
:git/tag "v0.5.0"
:git/sha "48bf01e"}
org.babashka/cli {:mvn/version "0.6.45"}
version-clj/version-clj {:mvn/version "2.0.2"}
org.babashka/http-client {:mvn/version "0.1.4"}}})

@sg-qwt
Copy link

sg-qwt commented Sep 30, 2023

We can make neil more robust by not fetching dependencies at runtime, this means we'll have to distribute it as an uberjar.

Currently some neil dependencies are fetched on the first run:

neil/neil

Lines 8 to 16 in d76462a

(deps/add-deps '{:deps {borkdude/rewrite-edn {:mvn/version "0.4.6"}
org.babashka/spec.alpha {:git/url "https://github.com/babashka/spec.alpha"
:git/sha "1a841c4cc1d4f6dab7505a98ed2d532dd9d56b78"}
io.github.seancorfield/deps-new {:git/url "https://github.com/seancorfield/deps-new"
:git/tag "v0.5.0"
:git/sha "48bf01e"}
org.babashka/cli {:mvn/version "0.6.45"}
version-clj/version-clj {:mvn/version "2.0.2"}
org.babashka/http-client {:mvn/version "0.1.4"}}})

The uberjar approach without runtime fetching seems reasonable to me.

The issue I reported has actually nothing to do with this, it's nix specific. It's caused by nix's particular way of wrapped babashka that case. NixOS/nixpkgs#257473

@borkdude
Copy link
Contributor

borkdude commented Apr 2, 2024

In the meanwhile deps.clj has been made more robust.

@borkdude borkdude closed this as completed Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants