Yep you are right. I figured it out right after I posted this :) On Thursday, October 15, 2015 at 10:46:01 PM UTC-7, Andy Fingerhut wrote: > > James: > > This sounds to me likely to be known and expected behavior of xargs. Any > OS has maximum limitations on either number and/or total size of command > line arguments, and xargs is probably invoking multiple JVMs. > > Here is a portion of the man page for xargs on my Mac: > > Any arguments specified on the command line are given to utility upon > > each invocation, followed by some number of the arguments read from > the > > standard input of xargs. The utility is repeatedly executed until > stan- > > dard input is exhausted. > > Andy > > > On Thu, Oct 15, 2015 at 10:10 PM, James Paton <[email protected] > <javascript:>> wrote: > >> I ran into an apparent bug today when trying to stress test a program I >> wrote. The program was just supposed to tell you both the minimum and >> maximum integers supplied in the command line arguments. I tried using >> xargs to provide thousands of numbers when I encountered this issue. >> However, I can repro it as follows, using Leiningen 2.5.1 and Clojure >> 1.6.0. As you can see, when I do lein run, it prints an exception about >> "Method code too large", but then prints out Hello World. And when I use >> the uberjar, it just prints the output twice. >> >> jpaton2@jpaton2-mba ~/Projects> lein -v >> Leiningen 2.5.1 on Java 1.8.0_60 Java HotSpot(TM) 64-Bit Server VM >> jpaton2@jpaton2-mba ~/Projects> lein new app test-args >> Generating a project called test-args based on the 'app' template. >> jpaton2@jpaton2-mba ~/Projects> cd test-args/ >> jpaton2@jpaton2-mba ~/P/test-args> lein run >> Hello, World! >> jpaton2@jpaton2-mba ~/P/test-args> wc -l ../numbers >> 7514 ../numbers >> jpaton2@jpaton2-mba ~/P/test-args> xargs lein run -- < ../numbers >> Exception in thread "main" java.lang.RuntimeException: Method code too >> large!, >> compiling:(/private/var/folders/wd/shmj7jgd7sqbk9wyh8dp0lz1jq62k4/T/form-init6518370413228051607.clj:1:165) >> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6651) >> at clojure.lang.Compiler.analyze(Compiler.java:6445) >> at clojure.lang.Compiler.eval(Compiler.java:6700) >> at clojure.lang.Compiler.eval(Compiler.java:6693) >> at clojure.lang.Compiler.load(Compiler.java:7130) >> at clojure.lang.Compiler.loadFile(Compiler.java:7086) >> at clojure.main$load_script.invoke(main.clj:274) >> at clojure.main$init_opt.invoke(main.clj:279) >> at clojure.main$initialize.invoke(main.clj:307) >> at clojure.main$null_opt.invoke(main.clj:342) >> at clojure.main$main.doInvoke(main.clj:420) >> at clojure.lang.RestFn.invoke(RestFn.java:421) >> at clojure.lang.Var.invoke(Var.java:383) >> at clojure.lang.AFn.applyToHelper(AFn.java:156) >> at clojure.lang.Var.applyTo(Var.java:700) >> at clojure.main.main(main.java:37) >> Caused by: java.lang.RuntimeException: Method code too large! >> at clojure.asm.MethodWriter.getSize(MethodWriter.java:1872) >> at clojure.asm.ClassWriter.toByteArray(ClassWriter.java:775) >> at clojure.lang.Compiler$ObjExpr.compile(Compiler.java:4450) >> at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3904) >> at clojure.lang.Compiler.analyzeSeq(Compiler.java:6642) >> ... 15 more >> Hello, World! >> jpaton2@jpaton2-mba ~/P/test-args> lein uberjar >> Compiling test-args.core >> Created >> /Users/jpaton2/Projects/test-args/target/uberjar+uberjar/test-args-0.1.0-SNAPSHOT.jar >> Created >> /Users/jpaton2/Projects/test-args/target/uberjar/test-args-0.1.0-SNAPSHOT-standalone.jar >> jpaton2@jpaton2-mba ~/P/test-args> xargs java -jar >> target/uberjar/test-args-0.1.0-SNAPSHOT-standalone.jar < ../numbers >> Hello, World! >> Hello, World! >> >> I found, through trial and error, that it appears to be sharding the >> arguments in chunks of 5000, then calling -main once for each chunk. I can >> verify this by using a file with the first 7000 numbers and the following >> program: >> >> (ns test-args.core >> (:gen-class)) >> >> (defn -main >> [& args] >> (println (apply max (map #(Integer/parseInt %) args)))) >> >> Using that for my core.clj file, I get the following: >> >> jpaton2@jpaton2-mba ~/P/test-args> lein uberjar >> Compiling test-args.core >> Created >> /Users/jpaton2/Projects/test-args/target/uberjar+uberjar/test-args-0.1.0-SNAPSHOT.jar >> Created >> /Users/jpaton2/Projects/test-args/target/uberjar/test-args-0.1.0-SNAPSHOT-standalone.jar >> jpaton2@jpaton2-mba ~/P/test-args> xargs java -jar >> target/uberjar/test-args-0.1.0-SNAPSHOT-standalone.jar < ../numbers >> 4999 >> 6999 >> >> Curious if this is a known problem and whether anyone can offer insight. >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to [email protected] >> <javascript:> >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> [email protected] <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > >
-- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
