Skip to content

Java / Leiningen (Clojure build tool) does not work #911

Closed

Description

@conan

I'm experiencing the same problem as #277. There's a matching issue in Leiningen. On a fresh install of Bash on Windows, I did

sudo apt-get install default-jdk
sudo apt-get install leiningen

Then I did this:

conan@ALLP0023:/mnt/c/Users/Conan$ which java
/usr/bin/java

conan@ALLP0023:/mnt/c/Users/Conan$ java -version
java version "1.7.0_101"
OpenJDK Runtime Environment (IcedTea 2.6.6) (7u101-2.6.6-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)

conan@ALLP0023:/mnt/c/Users/Conan$ which lein
/usr/bin/lein

Then this takes ages (> 10 mins), and eventually prints the error:

conan@ALLP0023:/mnt/c/Users/Conan$ lein -version
Leiningen is running in bundled mode.
#
[thread 139862623782656 also had an error]# A fatal error has been detected by the Java Runtime Environment:

#
#  Internal Error (safepoint.cpp:325), pid=11174, tid=139862530000640
#  guarantee(PageArmed == 0) failed: invariant
#
# JRE version: OpenJDK Runtime Environment (7.0_101) (build 1.7.0_101-b00)
# Java VM: OpenJDK 64-Bit Server VM (24.95-b01 mixed mode linux-amd64 compressed oops)
# Derivative: IcedTea 2.6.6
# Distribution: Ubuntu 14.04 LTS, package 7u101-2.6.6-0ubuntu0.14.04.1
# Core dump written. Default location: /mnt/c/Users/Conan/core or core.11174
#
# An error report file with more information is saved as:
# /mnt/c/Users/Conan/hs_err_pid11174.log
#
# If you would like to submit a bug report, please include
# instructions on how to reproduce the bug and visit:
#   http://icedtea.classpath.org/bugzilla
#
rlwrap: warning: java killed by SIGABRT (core dumped).
rlwrap has not crashed, but for transparency,
it will now kill itself with the same signal

/usr/bin/lein: line 126: 11173 Aborted                 (core dumped) $RLWRAP $LEIN_JAVA_CMD -Xbootclasspath/a:"$CLOJURE_JAR" -client $LEIN_JVM_OPTS -XX:+TieredCompilation -Dleiningen.original.pwd="$ORIGINAL_PWD" -Dleiningen.trampoline-file=$TRAMPOLINE_FILE -cp "$CLASSPATH" clojure.main -e "(use 'leiningen.core)(-main)" /dev/null "$@"

Dump file here:
hs_err_pid11174.zip

Activity

  1. russalex commented on Aug 16, 2016

    @russalex
    Contributor

    Which build of Windows are you running? (You can check by running verat a CMD prompt)

    If you are running the Anniversary Update (14393), there are many issues with Java and it's supporting tools. The most recent Insider build (14901) has addressed some of these.

  2. conan commented on Aug 16, 2016

    @conan
    Author

    Microsoft Windows [Version 10.0.14393]

    Yeah, it's on the Anniversary update

  3. benhillis commented on Aug 16, 2016

    @benhillis
    Member

    On the recent internal build this is working for me, I suspect that java fix Russ Alexander (@russalex) mentioned is responsible.

    Microsoft Windows [Version 10.0.14904]
    
    benhill@BENHILL-X1:~$ lein -version
    That's not a task. Use "lein help" to list all tasks.
    benhill@BENHILL-X1:~$ lein --version
    Leiningen 1.7.1 on Java 1.7.0_101 OpenJDK 64-Bit Server VM
    
  4. conan commented on Aug 17, 2016

    @conan
    Author

    Can you run lein repl?

  5. benhillis commented on Aug 17, 2016

    @benhillis
    Member

    Looks like it's working. If there's a more complicated example I can try (like a GitHub project I can try) please let me know.

    benhill@BENHILL-X1:~$ lein repl
    REPL started; server listening on localhost port 16816
    user=> (println "Hello, World")
    Hello, World
    nil
    user=>
    
    
  6. leftofnull commented on Aug 20, 2016

    @leftofnull

    I'm really excited that the lein repl appears to be working on internal. Is there any ballpark on when it will be released? I'm on the official anniversary build, I turned off insider temporarily.

    Also, would it be possible to test this repo in the internal:
    https://github.com/functional-koans/clojure-koans

    test after cloning by running

    $ lein deps
      ...
    $ lein koan run
    

    Output similar to the following would be a success:

    Now meditate on /home/colin/Projects/clojure-koans/src/koans/01_equalities.clj:3
    ---------------------
    Assertion failed!
    We shall contemplate truth by testing reality, via equality.
    (= __ true)
    
  7. conan commented on Oct 10, 2016

    @conan
    Author

    I don't seem to be able to run a REPL, even using the insider build:

    conan@ALLP0122:/mnt/c/Users/ccook/dev$ lein -v
    Leiningen 2.7.1 on Java 1.8.0_101 Java HotSpot(TM) 64-Bit Server VM
    conan@ALLP0122:/mnt/c/Users/ccook/dev$ lein new banana
    Generating a project called banana based on the 'default' template.
    The default template is intended for library projects, not applications.
    To see other templates (app, plugin, etc), try `lein help new`.
    conan@ALLP0122:/mnt/c/Users/ccook/dev$ cd banana
    conan@ALLP0122:/mnt/c/Users/ccook/dev/banana$ lein repl
    Exception in thread "Thread-3" java.io.IOException: Cannot run program "java" (in directory "/mnt/c/Users/ccook/dev/banana"): error=12, Cannot allocate memory
            at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
            at java.lang.Runtime.exec(Runtime.java:620)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)
            at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)
            at leiningen.core.eval$sh.invokeStatic(eval.clj:179)
            at leiningen.core.eval$sh.doInvoke(eval.clj:173)
            at clojure.lang.RestFn.applyTo(RestFn.java:137)
            at clojure.core$apply.invokeStatic(core.clj:646)
            at clojure.core$apply.invoke(core.clj:641)
            at leiningen.core.eval$fn__5732.invokeStatic(eval.clj:262)
            at leiningen.core.eval$fn__5732.invoke(eval.clj:260)
            at clojure.lang.MultiFn.invoke(MultiFn.java:233)
            at leiningen.core.eval$eval_in_project.invokeStatic(eval.clj:366)
            at leiningen.core.eval$eval_in_project.invoke(eval.clj:356)
            at leiningen.repl$server$fn__11838.invoke(repl.clj:243)
            at clojure.lang.AFn.applyToHelper(AFn.java:152)
            at clojure.lang.AFn.applyTo(AFn.java:144)
            at clojure.core$apply.invokeStatic(core.clj:646)
            at clojure.core$with_bindings_STAR_.invokeStatic(core.clj:1881)
            at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1881)
            at clojure.lang.RestFn.invoke(RestFn.java:425)
            at clojure.lang.AFn.applyToHelper(AFn.java:156)
            at clojure.lang.RestFn.applyTo(RestFn.java:132)
            at clojure.core$apply.invokeStatic(core.clj:650)
            at clojure.core$bound_fn_STAR_$fn__4671.doInvoke(core.clj:1911)
            at clojure.lang.RestFn.invoke(RestFn.java:397)
            at clojure.lang.AFn.run(AFn.java:22)
            at java.lang.Thread.run(Thread.java:745)
    Caused by: java.io.IOException: error=12, Cannot allocate memory
            at java.lang.UNIXProcess.forkAndExec(Native Method)
            at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
            at java.lang.ProcessImpl.start(ProcessImpl.java:134)
            at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
            ... 31 more
    

    Microsoft Windows [Version 10.0.14936]

  8. seancorfield commented on Oct 19, 2016

    @seancorfield

    As a workaround, you can do lein trampoline repl -- and I'll also note that Boot seems to work just fine now on the latest insider build. I'm going to update #277 with some notes about that.

  9. seancorfield commented on Oct 19, 2016

    @seancorfield

    FWIW, I can't run any Clojure process that tries to fire up another command via the shell, i.e., the following call fails:

    (.exec (Runtime/getRuntime) "hostname")
    

    Fails with this error:

    IOException error=12, Cannot allocate memory java.lang.UNIXProcess.forkAndExec (UNIXProcess.java:-2)

  10. seancorfield commented on Oct 21, 2016

    @seancorfield

    Note: if I run the equivalent Java program, it works just fine on OpenJDK 8 and Oracle Java 8:

    import java.io.*;
    public class Example {
        public static void main(String [] args) {
            try {
                Process p = Runtime.getRuntime().exec( "hostname" );
                InputStream i = p.getInputStream();
                InputStreamReader r = new InputStreamReader( i );
                BufferedReader b = new BufferedReader( r );
                System.out.println( "hostname: " + b.readLine() );
            } catch ( Exception e ) {
                System.out.println( "failed: " + e.toString() );
            }
        }
    }
    

    So the problem is something specific to calling .exec inside the context of a Clojure process -- although I've also seen this inside other tooling that fails to fork new processes.

  11. seancorfield commented on Jan 12, 2017

    @seancorfield

    This is functioning correctly on build 15002 -- I assume because #1286 is fixed?

  12. benhillis commented on Jan 12, 2017

    @benhillis
    Member

    Sean Corfield (@seancorfield) - I suspect so. Thanks for confirming that this is working!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions