-
-
Notifications
You must be signed in to change notification settings - Fork 171
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
GraalVM native image file size. #326
Comments
Hi Rafał, Could you please link to a minimal test project that demonstrates the issue? Will make it easier for me or someone else to confirm the problem and debug. Thanks! |
I had the same issue, I removed a lot of timbre unnecessary dependencies for my project with: com.taoensso/timbre {:mvn/version "5.1.0"
:exclusions [org.julienxx/clj-slack
com.mchange/c3p0
org.graylog2/gelfclient
ymilky/franzy
com.newrelic.agent.java/newrelic-agent
cljs-node-io
congomongo
raven-clj]} I didn't confirm image size was reduced yet |
BTW this is my project: clojure-lsp/clojure-lsp#267 @ribelo you can also use Graalvm Dashboard to monitor image size: https://www.graalvm.org/docs/tools/dashboard/?ojr=help%3Btopic%3Dgetting-started.md |
@ericdallo Hi Eric, Are you certain that any of the deps excluded there are otherwise actually included by default? They certainly shouldn't be. If they are, do you have any idea why that might be? I'm not too familiar with Graal. Thanks, |
I just checked that with [com.taoensso/timbre "5.1.0"]
[cheshire "5.10.0"]
[com.fasterxml.jackson.core/jackson-core "2.10.2"]
[com.fasterxml.jackson.dataformat/jackson-dataformat-cbor "2.10.2"]
[com.fasterxml.jackson.dataformat/jackson-dataformat-smile "2.10.2"]
[tigris "0.1.2"]
[cljs-node-io "1.1.2"]
[org.clojure/clojurescript "1.10.339"]
[com.google.javascript/closure-compiler-unshaded "v20180610"]
[args4j "2.33"]
[com.google.javascript/closure-compiler-externs "v20180610"]
[com.google.jsinterop/jsinterop-annotations "1.0.0"]
[com.google.protobuf/protobuf-java "3.0.2"]
[org.clojure/google-closure-library "0.0-20170809-b9c14c6b"]
[org.clojure/google-closure-library-third-party "0.0-20170809-b9c14c6b"]
[org.mozilla/rhino "1.7R5"]
[com.mchange/c3p0 "0.9.5.5"]
[com.mchange/mchange-commons-java "0.2.19"]
[com.newrelic.agent.java/newrelic-agent "3.30.0"]
[com.taoensso/encore "3.9.2"]
[com.taoensso/truss "1.6.0"]
[congomongo "2.2.1"]
[org.mongodb/mongo-java-driver "3.10.2"]
[io.aviso/pretty "0.1.37"]
[irclj "0.5.0-alpha4"]
[net.java.dev.jna/jna "5.6.0"]
[org.clojure/java.jdbc "0.7.11"]
[org.graylog2/gelfclient "1.5.0" :exclusions [[com.fasterxml.jackson.core/jackson-core]]]
[io.netty/netty-handler "4.1.42.Final"]
[io.netty/netty-buffer "4.1.42.Final"]
[io.netty/netty-codec "4.1.42.Final"]
[io.netty/netty-common "4.1.42.Final"]
[io.netty/netty-transport "4.1.42.Final"]
[io.netty/netty-resolver "4.1.42.Final"]
[org.slf4j/slf4j-api "1.7.25"]
[org.julienxx/clj-slack "0.6.3"]
[clj-http "2.0.0"]
[commons-io "2.4" :exclusions [[org.clojure/clojure]]]
[org.apache.httpcomponents/httpclient "4.5" :exclusions [[org.clojure/clojure]]]
[commons-logging "1.2"]
[org.apache.httpcomponents/httpcore "4.4.1" :exclusions [[org.clojure/clojure]]]
[org.apache.httpcomponents/httpmime "4.5" :exclusions [[org.clojure/clojure]]]
[org.zeromq/cljzmq "0.1.4"]
[org.zeromq/jzmq "3.0.1"]
[raven-clj "1.6.0"]
[org.martinklepsch/clj-http-lite "0.4.1"]
[prone "1.0.1"]
[server-socket "1.0.0"]
[ymilky/franzy "0.0.1"]
[org.apache.kafka/kafka-clients "0.9.0.1"]
[net.jpountz.lz4/lz4 "1.2.0"]
[org.xerial.snappy/snappy-java "1.1.1.7"]
[ymilky/franzy-common "0.0.1"]
So is not related to graal, not sure why it's adding that jars thought |
Is there any chance that it's including these libs from here? |
I'm just adding this to my deps.edn: |
Where are you running
In other words: it's normal for
Does that make sense? |
It makes sense, but I'm already running from my project root 🤔 |
So just to triple check: you're running If so, I'm not sure offhand what could cause that- that's unexpected for me but I might be missing something obvious. Could you please add Important: please check |
Yep Result of pprinted{:description "Clojure sample", :compile-path "/home/greg/dev/clojure-sample/target/default/classes", :deploy-repositories [["clojars" {:url "https://repo.clojars.org/", :password :gpg, :username :gpg}]], :group "clojure-sample", :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0", :url "https://www.eclipse.org/legal/epl-2.0/"}, :resource-paths ("/home/greg/dev/clojure-sample/dev-resources" "/home/greg/dev/clojure-sample/resources"), :uberjar-merge-with {"META-INF/plexus/components.xml" leiningen.uberjar/components-merger, "data_readers.clj" leiningen.uberjar/clj-map-merger, #"META-INF/services/.*" [clojure.core/slurp (fn* [p1__7686__7688__auto__ p2__7687__7689__auto__] (clojure.core/str p1__7686__7688__auto__ "\n" p2__7687__7689__auto__)) clojure.core/spit]}, :name "clojure-sample", :checkout-deps-shares [:source-paths :test-paths :resource-paths :compile-path #'leiningen.core.classpath/checkout-deps-paths], :source-paths ("/home/greg/dev/clojure-sample/src"), :eval-in :subprocess, :repositories [["central" {:url "https://repo1.maven.org/maven2/", :snapshots false}] ["clojars" {:url "https://repo.clojars.org/"}]], :test-paths ("/home/greg/dev/clojure-sample/test"), :target-path "/home/greg/dev/clojure-sample/target/default", :prep-tasks ["javac" "compile"], :java-source-paths ("/home/greg/dev/clojure-sample/src-java"), :native-path "/home/greg/dev/clojure-sample/target/default/native", :offline? false, :root "/home/greg/dev/clojure-sample", :javac-options ["-implicit:none"], :pedantic? ranges, :clean-targets [:target-path], :plugins ([lein-pprint/lein-pprint "1.3.2"]), :url "http://github/com/ericdallo/clojure-sample", :profiles {:uberjar {:aot [:all], :jvm-opts ["-server" "-Dclojure.compiler.direct-linking=true" "-Dclojure.spec.skip-macros=true"]}, :native-image {:dependencies ([ericdallo/sqlite-jni-graal-fix "0.0.1-graalvm-20.2.0"] [org.graalvm.nativeimage/svm "20.2.0"])}}, :plugin-repositories [["central" {:url "https://repo1.maven.org/maven2/", :snapshots false}] ["clojars" {:url "https://repo.clojars.org/"}]], :aliases {"downgrade" "upgrade", "jet" ["run" "-m" "jet.main" "--to-json"]}, :version "0.1.0-SNAPSHOT", :jar-exclusions [#"^\." #"\Q/.\E"], :main clojure-sample.core, :global-vars {}, :uberjar-exclusions [#"(?i)^META-INF/[^/]*\.(SF|RSA|DSA)$"], :jvm-opts ["-XX:-OmitStackTraceInFastThrow" "-XX:+TieredCompilation" "-XX:TieredStopAtLevel=1"], :dependencies ([org.clojure/data.json "1.0.0"] [org.clojure/clojure "1.10.2"] [nubank/matcher-combinators "3.1.2"] [org.eclipse.lsp4j/org.eclipse.lsp4j "0.10.0" :exclusions ([org.eclipse.xtend/org.eclipse.xtend.lib])] [digest/digest "1.4.10"] [cljfmt/cljfmt "0.7.0" :exclusions ([rewrite-cljs/rewrite-cljs] [rewrite-clj/rewrite-clj])] [rewrite-clj/rewrite-clj "0.6.1"] [org.eclipse.xtend/org.eclipse.xtend.lib "2.25.0.M1" :exclusions ([com.google.guava/guava])] [seancorfield/next.jdbc "1.1.613"] [com.google.guava/guava "30.1-jre"] [com.taoensso/timbre "5.1.0"] [prismatic/schema "1.1.12"] [org.clojure/tools.reader "1.3.4"] [nrepl/nrepl "0.8.3"] [org.xerial/sqlite-jdbc "3.34.0"] [org.clojure/core.async "1.3.610"] [clojure-complete/clojure-complete "0.2.5" :exclusions ([org.clojure/clojure])] [borkdude/jet "0.0.6"]), :release-tasks [["vcs" "assert-committed"] ["change" "version" "leiningen.release/bump-version" "release"] ["vcs" "commit"] ["vcs" "tag"] ["deploy"] ["change" "version" "leiningen.release/bump-version"] ["vcs" "commit"] ["vcs" "push"]], :test-selectors {:default (constantly true)}} I can't see the extra deps there though |
@ericdallo This is your project, right? You seem to be using a local version of Timbre (
Which is correct / as expected. This with:
I'd check your Only other thing I can think to add is that your |
Actually, I was testing on https://github.com/ericdallo/clojure-sample, but thanks for the debugging :) |
Just confirming that if I add
Besides some sort of implicit config in your environment, or something wrong with your version of leiningen- I'm out of ideas on what could cause you to be pulling in transitive :dev dependencies. I'll note that I'm not familiar with this leiningen + deps.edn approach, so could be I'm missing something obvious. |
Hum, odd indeed, I use lein 2.9.5 and did exactly what you did, also I don't have any config on my |
👍 BTW will check the spit-appender PR from you tomorrow. |
Thank you! It's the only missing external dependency of clojure-lsp/clojure-lsp#267 |
At least one person apparently seems to be somehow transitively pulling in Timbre's :dev dependencies. Unclear how/why that might be happening. In any case, as a temporary workaround- it's not a big problem to just disable these dependencies by default for now.
All of the |
@gsnewmark Hi Ivan!
Just to absolutely confirm: with Timbre v5.1.1 (so current version) - you're seeing all the Something quite unexpected is happening then, since the I wonder if there could be an obscure issue with the keyword technically being invalid (starting with a "3"). Not obvious how that'd manifest in the observed problem, but will try check next I have a chance. Unfortunately still haven't been able to reproduce this problem myself. |
@ptaoussanis yep. Unfortunately the project is closed-source, so I can't share the exact
But when we update it to
This is reproduced for me (NixOS + Leiningen) and for at least two of my colleagues (one with NixOS, one with OS X). Adding explicit exclusions helps:
but frankly speaking I also don't understand what's causing such a drastic change in the transitive dependencies as at first glance none of the commits since the 5.0.1 could have caused this. |
🙂 It looks like the dependencies are only included in the 5.1.1: https://clojars.org/com.taoensso/timbre/versions/5.1.1 But none of them are present in the 5.1.0 (we skipped this one, so I wasn't sure about it before): |
@gsnewmark Thanks for the detailed info Ivan!! The Clojars info is particularly helpful. For some reason haven't been able to reproduce this locally, but if the problem shows up on Clojars - then I have a way to test changes. Should have some time tomorrow or Fri to solve + cut a new release. |
Oh, I knew it I was not that crazy :p |
Investigating now. First results are very interesting: it looks like it's either something on my system causing the problem, or a problem with Lein or Clojars itself.
So clearly something outside of the code + project itself is causing :dev dependencies to be included in Clojars where they should not. Will continue looking. Update- things I've already ruled out:
|
Managed to create a minimum reproducible project. With the following project.clj: (defproject com.taoensso.tests/clojars-test "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
:url "https://www.eclipse.org/legal/epl-2.0/"}
:dependencies [[org.clojure/clojure "1.10.1"]]
:profiles
{:ring {:dependencies [[ring "1.8.2"]]}
:dev [:ring]}
:repl-options {:init-ns clojars-test.core})
|
Looks like a possible regression in leiningen: technomancy/leiningen#2721 |
Okay, so good news: I've confirmed that if I downgrade to lein 2.9.1 then my deployments stop showing this problem. There should be no need for any library users to downgrade their lein version. More info on #lein/2721. Thanks again to everyone for the reports, assistance, and patience on this! |
Thanks @ptaoussanis I could confirm that is an issue on lein, I have another lib that I deployed with |
Turned out that the issue was being caused during deployment by a regression in Leiningen >=2.9.2 (incl. 2.9.5): #326 (comment) This workaround can be removed, I'll just deploy with Lein 2.9.1 until the upstream issue is solved.
Adding
timbre
to the dependency, causes the native image file to grow by approximately ~50mb.The text was updated successfully, but these errors were encountered: