calva icon indicating copy to clipboard operation
calva copied to clipboard

The REPL process dies without Calva ”noticing” it when using one JDK (but works with another JDK)

Open SonyaHon opened this issue 3 years ago • 15 comments

  • VSCode version: 1.68
  • Calva version: 2.0.286
  • OS: MacOS Monterey 12.4 M1 Chip

While the command seems to be executing, (e.g. it will show an error if u are not connected to the repl at all) After the evaluation is completed the result is not being shown anywhere. Nor in the REPL/Output window, nor inline in the editor. Initially i thought the problem was with my project setup, but the default calva tutorial has the same problem

SonyaHon avatar Jun 22 '22 08:06 SonyaHon

Hi!

I'm not quite following. Can you describe the steps you take to get to the error?

Afaik we do not show an error if you evaluate forms without a REPL connected. We instead show some options for connecting a REPL.

PEZ avatar Jun 22 '22 08:06 PEZ

  1. Open default calva tutorial via Calva: Fire up the Gettings Started REPL
  2. Follow the tutorial, place the cursor anywhere on the 3rd line and press the keybinding.
  3. Nothing happens E.R. The output is showed somewhere

If u try to evaluate a form without a repl connection the error message in the right bottom corner appears

CleanShot 2022-06-22 at 12 55 09

SonyaHon avatar Jun 22 '22 09:06 SonyaHon

Btw, trying to evaluate a line in the REPL leads to noting as well. Only the "evaluated" form is highlighted a bit but no actual output is being shown. Nor side effects (like printing)

SonyaHon avatar Jun 22 '22 22:06 SonyaHon

Can you try with using the commands from the command palette and see if that makes a difference? So, instead of using the keybindings, bring up the command palette and execute a command like Calva: Evaluate Top Level Form (defun).

PEZ avatar Jun 23 '22 06:06 PEZ

Iv tried it as well. The result is the same

SonyaHon avatar Jun 23 '22 08:06 SonyaHon

I can't reproduce this. @SonyaHon Can you paste the output from the dev console after you reproduce the issue? Help -> Toggle Developer Tools -> Console Tab.

bpringe avatar Jun 26 '22 23:06 bpringe

@SonyaHon Also, do you have Java installed and on your path?

bpringe avatar Jun 26 '22 23:06 bpringe

 java --version
openjdk 18.0.1 2022-04-19
OpenJDK Runtime Environment (build 18.0.1+10-24)
OpenJDK 64-Bit Server VM (build 18.0.1+10-24, mixed mode, sharing)
[Extension Host] Downloaded hello_paredit.clj
console.ts:137 [Extension Host] Downloaded welcome_to_clojure.clj
console.ts:137 [Extension Host] Downloaded hello_repl.clj
console.ts:137 [Extension Host] Downloaded deps.edn
console.ts:137 [Extension Host] File opened: /var/folders/1_/gjv7ypw12cg3q30syh3407t40000gn/T/betterthantomorrow.calva/znrbt/hello_repl.clj lid: clojure
console.ts:137 [Extension Host] FileMonitor has detected change in language: clojure
console.ts:137 [Extension Host] Collapsing all regions
console.ts:137 [Extension Host] Getting regions for language clojure.
console.ts:137 [Extension Host] folding lines: 
console.ts:137 [Extension Host] Collapsing all regions
console.ts:137 [Extension Host] Getting regions for language clojure.
console.ts:137 [Extension Host] folding lines: 
console.ts:137 [Extension Host] DocumentRecord Interval running for doc /var/folders/1_/gjv7ypw12cg3q30syh3407t40000gn/T/betterthantomorrow.calva/znrbt/hello_repl.clj
console.ts:137 [Extension Host] File opened: /var/folders/1_/gjv7ypw12cg3q30syh3407t40000gn/T/betterthantomorrow.calva/znrbt/hello_paredit.clj lid: clojure
console.ts:137 [Extension Host] FileMonitor has detected change in language: clojure
console.ts:137 [Extension Host] Collapsing all regions
console.ts:137 [Extension Host] Getting regions for language clojure.
console.ts:137 [Extension Host] folding lines: 
console.ts:137 [Extension Host] Collapsing all regions
console.ts:137 [Extension Host] Getting regions for language clojure.
console.ts:137 [Extension Host] folding lines: 
console.ts:137 [Extension Host] DocumentRecord Interval running for doc /var/folders/1_/gjv7ypw12cg3q30syh3407t40000gn/T/betterthantomorrow.calva/znrbt/hello_paredit.clj
console.ts:137 [Extension Host] File opened: /var/folders/1_/gjv7ypw12cg3q30syh3407t40000gn/T/betterthantomorrow.calva/znrbt/welcome_to_clojure.clj lid: clojure
console.ts:137 [Extension Host] FileMonitor has detected change in language: clojure
console.ts:137 [Extension Host] Collapsing all regions
console.ts:137 [Extension Host] Getting regions for language clojure.
console.ts:137 [Extension Host] folding lines: 
console.ts:137 [Extension Host] Collapsing all regions
console.ts:137 [Extension Host] Getting regions for language clojure.
console.ts:137 [Extension Host] folding lines: 
console.ts:137 [Extension Host] DocumentRecord Interval running for doc /var/folders/1_/gjv7ypw12cg3q30syh3407t40000gn/T/betterthantomorrow.calva/znrbt/welcome_to_clojure.clj
console.ts:137 [Extension Host] File opened: /var/folders/1_/gjv7ypw12cg3q30syh3407t40000gn/T/betterthantomorrow.calva/znrbt/.calva/output-window/output.calva-repl lid: clojure
console.ts:137 [Extension Host] FileMonitor has detected change in language: clojure
console.ts:137 [Extension Host] Collapsing all regions
console.ts:137 [Extension Host] Getting regions for language clojure.
console.ts:137 [Extension Host] folding lines: 
console.ts:137 [Extension Host] Collapsing all regions
console.ts:137 [Extension Host] Getting regions for language clojure.
console.ts:137 [Extension Host] folding lines: 
console.ts:137 [Extension Host] DocumentRecord Interval running for doc /var/folders/1_/gjv7ypw12cg3q30syh3407t40000gn/T/betterthantomorrow.calva/znrbt/.calva/output-window/output.calva-repl
console.ts:137 [Extension Host] Jack-in process kill requested
console.ts:137 [Extension Host] Closing any ongoing stdin event
console.ts:137 [Extension Host] Jack-in process kill requested
console.ts:137 [Extension Host] Socket closed
console.ts:137 [Extension Host] Killing the Jack-in process
console.ts:137 [Extension Host] Unhandled error: n.trim is not a function
I @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:473
_invokeHandler @ rpcProtocol.ts:458
_receiveRequest @ rpcProtocol.ts:374
_receiveOneMessage @ rpcProtocol.ts:296
(anonymous) @ rpcProtocol.ts:161
invoke @ event.ts:575
deliver @ event.ts:779
fire @ event.ts:740
fire @ ipc.net.ts:638
_receiveMessage @ ipc.net.ts:958
(anonymous) @ ipc.net.ts:831
invoke @ event.ts:575
deliver @ event.ts:779
fire @ event.ts:740
acceptChunk @ ipc.net.ts:382
(anonymous) @ ipc.net.ts:338
L @ ipc.net.ts:60
emit @ node:events:390
addChunk @ node:internal/streams/readable:315
readableAddChunk @ node:internal/streams/readable:289
Readable.push @ node:internal/streams/readable:228
onStreamRead @ node:internal/stream_base_commons:199

Some interesting thing there is that Unhadled error n.trim is not a function is thrown only once. Futher tries to eval a form do not trigger this error

SonyaHon avatar Jun 27 '22 17:06 SonyaHon

Changing Java version to 11.0.15 actually fixed it.

SonyaHon avatar Jun 27 '22 20:06 SonyaHon

Oh wow. @PEZ Maybe something with OpenJDK 18 doesn't play well with Calva, at least with regard to the getting started repl?

@SonyaHon Did you kill the jack-in process yourself? It looks like something caused it to be killed, which would explain why you couldn't evaluate any forms.

console.ts:137 [Extension Host] Jack-in process kill requested
console.ts:137 [Extension Host] Closing any ongoing stdin event
console.ts:137 [Extension Host] Jack-in process kill requested
console.ts:137 [Extension Host] Socket closed
console.ts:137 [Extension Host] Killing the Jack-in process
console.ts:137 [Extension Host] Unhandled error: n.trim is not a function

bpringe avatar Jun 28 '22 02:06 bpringe

Nope. I did not kill it. And there was a REPL Connected thingy in the bottom bar of VSCode. As i already sad, this problem exists not only in getting started repl, but everywhere.

I guess we should consider this closed as the issue is caused by me using OpenJDK 18. Switching to OpenJDK 11 fixed the problem.

SonyaHon avatar Jun 28 '22 08:06 SonyaHon

Thanks for the info. @PEZ Do you want to leave this open under this new name and maybe investigate further later, or close it?

bpringe avatar Jun 29 '22 03:06 bpringe

I think we should keep it open. But we need another name, because JDK 18 isn't the problem. I use OpenJDK 18 as my default JDK and it works great.

% java --version
openjdk 18.0.1 2022-04-19
OpenJDK Runtime Environment Zulu18.30+11-CA (build 18.0.1+10)
OpenJDK 64-Bit Server VM Zulu18.30+11-CA (build 18.0.1+10, mixed mode, sharing)

@SonyaHon do you remember how you installed OpenJDK 18 on your machine? And what's the value of $JAVA_HOME on your machine? Thinking that if it is pointing somewhere else than JDK 18 when you are using that, maybe that can cause the issues. (My knowledge about how the JDK/JVM is bootstrapped is very limited, so I am just guessing stuff here.)

PEZ avatar Jun 29 '22 06:06 PEZ

Don't know if the name I choose now is very good, but I tried to capture what I think is the Calva issue here. We can't do very much about a JDK that isn't properly configured, but Calva keeps indicating that things are good even though the REPL has died. That's at least actionable. (Even though I really don't understand why it glitches.)

PEZ avatar Jun 29 '22 06:06 PEZ

Iv installed both 18 and 11 via brew. $JAVA_HOME is empty. The 18 version is used via PATH to java elf, than i created and alias java=path/to/java11 elf.

SonyaHon avatar Jun 29 '22 09:06 SonyaHon

Closing this as we have no real clues what we can do about it. If someone finds more clues and also finds this issue, please reopen.

PEZ avatar Mar 14 '23 08:03 PEZ