-
-
Notifications
You must be signed in to change notification settings - Fork 372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use of deprecated Thread.stop
prevents interruption on Java 20+
#1379
Comments
Thread.stop
prevents working on Java 20+Thread.stop
prevents interruption on Java 20+
A problem here, IIUC, is that there's no real substitute for |
I suspect it might be possible to re implement this using JNI, but I'm not familiar enough with the JVM C API to know for sure |
Bypassing the public Java API to reach into the JVM for the The thing about being a REPL though is that you sort of have control over the compiler, at least for the part that was entered through the REPL. It might be possible to artificially add in a "blackhole"-style empty method at the backedges of all the loops to allow interrupts to have an anchor point to deliver to. For reference, here's JDK8 HotSpot JVM/Linux's |
We don't actually have full control over the compiler due to Scala's binary dependencies; people pull in all sorts of Java/Scala jars from maven central or other projects those come pre-compiled. We could do a bytecode rewrite on load using a JVM agent. That's pretty invasive, and may hurt performance, but I've done it before in https://github.com/lihaoyi/6858 |
...SecurityManager is also on track for removal https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/SecurityManager.html |
Looks like a secret conspiracy to make threads immortal. 🤣 |
Steps to reproduce
while true do ()
(Scala 3)because in Java 20 (https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/Thread.html#stop()) the function has been "removed" and apparently should be replaced with
Thread.interrupt
and interruption checking/allowing on the execution thread.The problematic line seems to be here:
Ammonite/amm/repl/src/main/scala/ammonite/repl/Repl.scala
Line 191 in 084f7f4
Expected behavior
I expected to be able to interrupt long running programs, which was one of the advertised benefits of Ammonite-REPL.
Environment
Ammonite: 3.0.0-M0-53-084f7f4e
Scala: 3.3.1
Java: 20
The text was updated successfully, but these errors were encountered: