technomancy / leiningen

Moved to Codeberg; this is a convenience mirror
https://codeberg.org/leiningen/leiningen
Other
7.29k stars 1.6k forks source link

leiningen2 preview 4 REPL hangs #582

Closed borkdude closed 12 years ago

borkdude commented 12 years ago

When installing the .bat file on Windows XP, then running "lein self-install" and then "lein repl" I get a REPL which often hangs.

See this screenshot: http://twitpic.com/9l2pet After typing (+ 1 2 3) followed by a return nothing happens

Note that also "nil" is printed when starting up the REPL. Sometimes nil is printed between the intro text.

Sometimes the REPL already hangs before I can type anything (after printing nil): http://twitpic.com/9l2snf

I can only reproduce this bug on Windows XP, not on Windows 7.

Some debug info:

C:\Documents and Settings\Administrator>java -version java version "1.6.0_32" Java(TM) SE Runtime Environment (build 1.6.0_32-b05) Java HotSpot(TM) Client VM (build 20.7-b02, mixed mode, sharing)

C:\Documents and Settings\Administrator>lein version Leiningen 2.0.0-preview4 on Java 1.6.0_32 Java HotSpot(TM) Client VM

xeqi commented 12 years ago

On ubuntu 11.04 I can also get it to hang, or sometime just not print a result:

$ lein2 repl
All namespaces already :aot compiled.
nREPL server started on port 34796
Welcome to REPL-y!
Clojure 1.4.0
    Exit: Control+D or (exit) or (quit)
Commands: (user/help)
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
          (user/sourcery function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
Examples from clojuredocs.org: [clojuredocs or cdoc]
          (user/clojuredocs name-here)
          (user/clojuredocs "ns-here" "name-here")
May 14, 2012 5:37:17 PM com.mchange.v2.log.MLog <clinit>
INFO: MLog clients using java 1.4+ standard logging.
nil
clojars.main=> {:k 3}
{:k 3}
clojars.main=> (class {:k 3})

clojars.main=> Bye for now!

Note the blank space where the (class {:k 3}) result should have been. I stopped it there, but itt would most likely have hung on me on the next line.

Some debug info:

$ java -version
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.4) (6b22-1.10.4-0ubuntu1~11.04.2)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

$ lein2 version
Leiningen 2.0.0-preview4 on Java 1.6.0_22 OpenJDK 64-Bit Server VM
trptcolin commented 12 years ago

Yikes, this seems bad. Any other details you guys can give?

1) Does this happen every time/rarely/50%/etc, is memory/CPU constrained, any relevant plugins/CLASSPATH/JVM_OPTS settings?

2) Did this happen in preview3? Based on you guys' OS/JVM setups being so different, I'm hoping there's something else preventing me from reproducing this on OSX, besides just being on OSX.

3) When it hangs, I'm guessing you're blocked from all further actions, unable to just skip that output and execute other commands. Is that right?

xeqi commented 12 years ago
  1. (class {:k 3}) will always not produce output or hang. No output:hang:hang-without-prompt appears to be in the 3:15:1 ratio from trying quickly. ps output below, but it does not appear mem/cpu constrained. No CLASSPATH on my system. profiles.clj provided below.
  2. This is new on preview4. preview3 worked fine for me.
  3. C-C and C-d don't do anything. I have to go kill the process from another shell.

It doesn't matter if I am in a project or not.

ps:

vagrant@natty64:~$ ps aux | grep java
vagrant   2502  5.4 25.2 573828 94568 pts/0    Sl+  19:05   0:05 java -client -XX:+TieredCompilation -Xbootclasspath/a:/home/vagrant/.lein/self-installs/leiningen-2.0.0-preview4-standalone.jar -Dleiningen.original.pwd=/workspace -Dleiningen.trampoline-file=/tmp/lein-trampoline-2497 -cp /home/vagrant/.lein/self-installs/leiningen-2.0.0-preview4-standalone.jar clojure.main -m leiningen.core.main repl

profiles.clj:

{:user {:plugins [[lein-swank "1.4.3"]}}

I just killed it trying to see how often it happened and got output. Most of the time I do not get any output.

)
/home/vagrant/.bin/lein2: line 220:  2457 Killed                  $LEIN_JAVA_CMD -client -XX:+TieredCompilation $LEIN_JVM_OPTS -Dleiningen.original.pwd="$ORIGINAL_PWD" -Dleiningen.trampoline-file=$TRAMPOLINE_FILE -cp "$CLASSPATH" clojure.main -m leiningen.core.main "$@"
borkdude commented 12 years ago

1) Nothing special to see here: http://twitpic.com/9l3nxe 2) When switching back to preview3 it seems to work on XP. On OSX I can't reproduce this. One thought: could it be related to the paren matching which reply does (and doesn't seem to do on preview3?) It wouldn't explain why it hangs right away sometimes though: http://twitpic.com/9l2snf 3) Yes, I just can't type anything.

xeqi commented 12 years ago

babilen mentioned it running fine on debian/open-jdk7 in irc.

borkdude commented 12 years ago

Upgrading Java to 1.7.0_04 didn't change anything to the Windows XP lein repl hanging.

technomancy commented 12 years ago

I can't repro on Debian with Leiningen 2.0.0-SNAPSHOT on Java 1.6.0_24 OpenJDK 64-Bit Server VM fwiw.

trptcolin commented 12 years ago

Thanks a bunch for all the details & digging, guys. I'm able to reproduce in an Ubuntu VM, and with a little jdb fun, found that it's a deadlock reading from a lazy seq of nrepl responses (yay concurrency!). I introduced this when I made it so that you can keep printing after a return value for a given command.

I should have something ready for it before too long.

borkdude commented 12 years ago

FWIW, Could also reproduce it on Ubuntu: http://twitpic.com/9lfqt3 Sometimes output is not printed of (+1 2 3), sometimes it hangs after expression (+ 1 2 3).

leiningen version 2.0.0-preview4

java version "1.6.0_22" OpenJDK Runtime Environment (IcedTea6 1.10.6) (6b22-1.10.6-0ubuntu1) OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

ubuntu version 11.04 natty

twashing commented 12 years ago

I have the exact same hanging issue in a VMWare VM.

Linux ubuntu 2.6.35-22-generic #35-Ubuntu SMP ... i686 GNU/Linux Leiningen 2.0.0-preview4 on Java 1.6.0_21 Java HotSpot(TM) Client VM

trptcolin commented 12 years ago

I think I have a fix for this in REPL-y - I can no longer reproduce the problem using the command-line reply.sh. I'm pretty sure the problem was caused by a new polling consumer that handles things like asynchronous printing. I think it was eating the :done messages that are supposed to end the synchronous read-eval-print cycle. The change I made should prevent all kinds of consumer race conditions.

Please let me know if you can still reproduce using REPL-y master.

borkdude commented 12 years ago

I have tested reply master on Windows XP and could not reproduce the hangs anymore. (on a sidenote: the reply.bat script only runs succesfully when reply is built with lein1, so I had to download the old lein.bat file for this)

xeqi commented 12 years ago

I can not reproduce in REPL-y master. I also do not get the nil printed before the prompt.

trptcolin commented 12 years ago

Cool, so this'll get pulled into leiningen with the next REPL-y release (soonish). Yeah, reply.bat and reply.sh both depend on the lib directory. I think the standalone REPL-y will eventually just be an executable uberjar.

The nil-before-prompt thing was a separate thing I happened to fix recently: https://github.com/trptcolin/reply/commit/d9013687b3e971a650de9b5cf92f15a2c331f908

trptcolin commented 12 years ago

I did a reply release (0.1.0-beta7) and pulled it in: 27d48453979a8b5d0d7835c5d44a2cc1bc7d793c

So I expect this to be fine now on lein master.

borkdude commented 12 years ago

I tested this on XP and lein master works fine now regarding this issue.