calva icon indicating copy to clipboard operation
calva copied to clipboard

Cannot interrupt running evaluations on JDK 21+

Open maxrothman opened this issue 7 months ago • 6 comments

When interrupting an evaluation while using JDK 21, I get the following message:

ERROR: Cannot stop thread on JDK21+ without -Djdk.attach.allowAttachSelf enabled, see https://nrepl.org/nrepl/installation.html#jvmti.

This option should probably be included by default in all Java REPL connect sequences so the interrupt evaluations feature is able to work.

maxrothman avatar May 18 '25 15:05 maxrothman

Thanks. We could include that option by default I think. Probably best to inject it in the various command lines. So that you get a proper command line copied if you use Copy Jack-in Command Line.

PEZ avatar May 18 '25 16:05 PEZ

@alexander-yakushev, How does CIDER handle this? I think you have once told me, but I have forgotten. 😄

PEZ avatar Nov 06 '25 20:11 PEZ

See https://nrepl.org/nrepl/installation.html#jvmti and https://docs.cider.mx/cider/basics/up_and_running.html#enabling-nrepl-jvmti-agent.

alexander-yakushev avatar Nov 06 '25 20:11 alexander-yakushev

Thanks! When cider-enable-nrepl-jvmti-agent is enabled, do you inject the allowAttachSelf option in the jack-in command line, or do you set it in the jack-in enviroment?

PEZ avatar Nov 06 '25 21:11 PEZ

Not sure I understand what the "jack-in environment" is. We add it to jack-in command arguments.

alexander-yakushev avatar Nov 06 '25 21:11 alexander-yakushev

Cool. I'm thinking it could be done by executing the command in an environment with JAVA_TOOL_OPTIONS set to allow the attachments. Calva has a jackInEnv setting where it could fit. But maybe it makes more sense to add it to the command options.

PEZ avatar Nov 06 '25 21:11 PEZ