Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Show docs breaks instarepl on windows #1732

Closed
joshuafcole opened this issue Nov 20, 2014 · 14 comments
Closed

Show docs breaks instarepl on windows #1732

joshuafcole opened this issue Nov 20, 2014 · 14 comments
Assignees

Comments

@joshuafcole
Copy link
Contributor

I was recently walking a friend through generating music algorithmically in overtone. On introducing him to LT's instarepl for him to start writing some code, we found that the show docs function was generating 40 lines of error stack trace. This seems related to a previous issue involving temp file creation that I can't seem to find right now. The instarepl works fine normally before show docs is used. We used it on a regular function (in this case +). I can continue working with him to provide more diagnostic information.

OS: Win7x64
Version: 0.7.1
Clojure: 0.1.0

Repro:

1. Open new instarepl
2. Type `(+ 1 2)` works fine
3. Mouse click on `+`
4. ctrl-d to show docs
5. Check console for errors

Stack Trace:

java.io.IOException: The system cannot find the path specified
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.createTempFile(File.java:1879)
at java.io.File.createTempFile(File.java:1923)
at lighttable.nrepl.doc$jar_url__GT_file.invoke(doc.clj:59)
at lighttable.nrepl.doc$resolve_file.invoke(doc.clj:76)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$update_in.doInvoke(core.clj:5587)
at clojure.lang.RestFn.invoke(RestFn.java:445)
at lighttable.nrepl.doc$eval5979$fn__5981.invoke(doc.clj:116)
at clojure.lang.MultiFn.invoke(MultiFn.java:227)
at lighttable.nrepl.core$queued$fn__1851.invoke(core.clj:98)
at clojure.core$comp$fn__4154.invoke(core.clj:2330)
at clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__635.invoke(interruptible_eval.clj:138)
at clojure.lang.AFn.run(AFn.java:24)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
@kenny-evitt
Copy link
Contributor

@joshuafcole I can't repro this myself based on your steps. My InstaREPL is connected to LightTable ("LightTable-REPL"). Is yours a project? If so, can you provide a minimal project in which you can still repro this?

I'm running version 0.7.2 – maybe this was fixed since 0.7.1?

[Incidentally, I just upgraded from 0.6.7 and I miss the auto-closing parentheses.]

@kenny-evitt
Copy link
Contributor

[And, I already see that I'm not the only one that didn't read the change-log!]

@alilee
Copy link

alilee commented Dec 8, 2014

I'm getting this issue too. I'm sorry I can't say when it started because I pressed on for a while. Search language docs does work though.

My stack: LT 0.7.2 on Yosemite

java.io.IOException: No such file or directory
    at java.io.UnixFileSystem.createFileExclusively(Native Method)
    at java.io.File.checkAndCreate(File.java:1705)
    at java.io.File.createTempFile0(File.java:1726)
    at java.io.File.createTempFile(File.java:1838)
    at lighttable.nrepl.doc$jar_url__GT_file.invoke(doc.clj:59)
    at lighttable.nrepl.doc$resolve_file.invoke(doc.clj:76)
    at clojure.lang.AFn.applyToHelper(AFn.java:161)
    at clojure.lang.AFn.applyTo(AFn.java:151)
    at clojure.core$apply.invoke(core.clj:619)
    at clojure.core$update_in.doInvoke(core.clj:5587)
    at clojure.lang.RestFn.invoke(RestFn.java:445)
    at lighttable.nrepl.doc$eval5979$fn__5981.invoke(doc.clj:116)
    at clojure.lang.MultiFn.invoke(MultiFn.java:227)
    at lighttable.nrepl.core$queued$fn__1851.invoke(core.clj:98)
    at clojure.core$comp$fn__4154.invoke(core.clj:2330)
    at clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__635.invoke(interruptible_eval.clj:138)
    at clojure.lang.AFn.run(AFn.java:24)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:695)

@cldwalker
Copy link
Member

@alilee Can you create a tempfile from a clojure repl? To find out do:

  1. lein repl
  2. (import java.io.File)
  3. (File/createTempFile "TEST" "")

Also, what Java version are you running?

@alilee
Copy link

alilee commented Dec 8, 2014

Seems to work fine.

Java version from repl signature: Java HotSpot(TM) 64-Bit Server VM 1.6.0_65-b14-466.1-11M4716

~/clojure> lein new app repl-test
Generating a project called repl-test based on the 'app' template.
alilee@destrier-2 ~/clojure> cd repl-test/
alilee@destrier-2 ~/c/repl-test> lein repl
nREPL server started on port 54397 on host 127.0.0.1 - nrepl://127.0.0.1:54397
REPL-y 0.3.5, nREPL 0.2.6
Clojure 1.6.0
Java HotSpot(TM) 64-Bit Server VM 1.6.0_65-b14-466.1-11M4716
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

repl-test.core=> (import java.io.File)
java.io.File
repl-test.core=> (File/createTempFile "TEST" "")
#<File /var/folders/5x/f49y8j0s4qb1qkr2ss0gjyk00000gn/T/TEST2779004516657682307>
repl-test.core=> 

@joshuafcole
Copy link
Contributor Author

Interesting. Any other thoughts on what might help unravel this mystery? I had expected it to be platform specific. I suppose it's plausible that there's a race condition, but unless Show Docs is infrequently used, I'd have expected more reports about it by now.

@cldwalker
Copy link
Member

@joshuafcole @alilee I'm guessing the reason it passes for the above repl session and fails in the editor is a difference in File/createTempFile arguments, possibly one of them being nil or having spaces in the string. If you want to debug this, try the following:

  • Make sure you have the latest 0.1.0 plugin and cd 'Clojure/lein-light-nrepl'
  • Add a print statement right before this line e.g. (prn "JUMP:" relative-name ext (.getPath jar-url))
  • Install the debugging clojar while in that directory with lein install
  • Start LightTable, open your console with command "Toggle console" and jump to source
  • You should see the args in the console that are causing your issue

I'm happy to fix if I can get those debugging values

@alilee
Copy link

alilee commented Dec 15, 2014

Thanks very much for the strategy.

"JUMP:" "clojure/core" " : " ".clj" " : " "file:/Users/alilee/.m2/repository/org/clojure/clojure/1.5.1/clojure-1.5.1.jar!/clojure/core.clj"

Capturing that output is tricky btw:

(let [[_ relative-name ext] (re-find #"!/(.*)(\.[^.]+)$" (.getPath jar-url))
         _ (prn "JUMP:" relative-name " : " ext " : " (.getPath jar-url))
         _ (flush)
         new-file (.getPath (File/createTempFile relative-name ext))
         body (-> jar-url .getContent slurp)]
     (swap! jar-temp-files assoc (.getPath jar-url) new-file)
     (spit new-file body)
     new-file)

@jdwaterson
Copy link

FWIW, I just had this problem too, using LT 0.7.2 on Yosemite (10.10.1).

I've now fixed it by installing the latest JDK (8u25) and forcing the /usr/bin/java stubs to point to this version, specifically by adding this to my dotfiles:

export JAVA_HOME=/usr/libexec/java_home -v '1.8*'

Restarted LT and now it works properly. Not sure whether updating JAVA_HOME was strictly necessary for LT; I did the JDK install and edited dotfiles at the same time so can't prove it one way or t'other.

Note for ref that I tried updating just the JRE first of all to no effect. It needed the whole JDK.

Also for completeness, java versions before...

$ java -version
java version "1.7.0_11"
Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)

...and after:

$ java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

Hope this helps a bit.

@dxlr8r
Copy link

dxlr8r commented Mar 20, 2015

@jdwaterson thank you 👍

@martinchooooooo
Copy link
Contributor

Can confirm that I was having the same issue and I had tried (before reading this issue) the same approach of upgrading from JDK 7 to JDK 8 and it seemed to have fixed my issue,

@kenny-evitt
Copy link
Contributor

@joshuafcole @cldwalker could either or both of you confirm whether this is resolved by upgrading the JDK to version 8?

@acceleanu
Copy link

I had the same issue on a mac. Switched to Java 8 and that resolved it. A nice way to manage multiple versions of java is by using http://www.jenv.be .

@cldwalker
Copy link
Member

Apologies for getting back to this thread late. Too many issues and too small of a core team. As you all have discovered jump to source targeted Java 8. The Clojure plugin will no longer support Java 7 as Oracle hasn't supported it since April of this year. I've updated the Clojure plugin to reflect this - LightTable/Clojure@ae40383

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants