Skip to content

Conversation

@bulasevich
Copy link
Contributor

@bulasevich bulasevich commented Nov 10, 2025

Backports:

Conflicts:

  • VMThreads.java merge conflict: if-block body changed on mainline.
  • Resolution: updated the if-block condition manually.
  • For reference, mainline commit 5fc4163 (missing in the GraalVM Community JDK 21u codebase) modified the if-block content
+++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/VMThreads.java
@@ -702,8 +676,12 @@ public abstract class VMThreads {
             while (thread.isNonNull()) {
                 IsolateThread next = nextThread(thread);
                 if (thread.notEqual(currentThread) && !wasStartedByCurrentIsolate(thread)) {
-                    detachThreadInSafeContext(thread);
-                    releaseThread(thread);
+                    /*
+                     * The code below is similar to VMThreads.detachCurrentThread() except that it
+                     * doesn't call VMThreads.threadExit(). We assume that this is tolerable
+                     * considering the immediately following tear-down.
+                     */
+                    VMThreads.singleton().detachThread(thread, false);
                 }
                 thread = next;
             }

Closes: #223

Ensure `DetachAllExternallyStartedThreadsExceptCurrentOperation` doesn't
detach the thread starting the operation as that may leave it in an
inconsistent state. `leaveTearDownIsolate` will properly teardown/detach
both the operation thread (if there is one) and the current thread.

(cherry picked from commit 51dfe873c05f5d276efb348a93395d2bf3fee03b)
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Nov 10, 2025
@bulasevich bulasevich marked this pull request as ready for review November 12, 2025 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Backport] [Oracle GraalVM] [GR-67842] Backport to 23.1: Espresso standalone with G1 gets stuck if there is an argument is not recognized.

2 participants