Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8189170

Add option to disable stack overflow checking in primordial thread for use with JNI_CreateJavaJVM

    Details

    • Subcomponent:
    • Resolved In Build:
      b34
    • CPU:
      generic
    • OS:
      linux

      Backports

        Description

        A DESCRIPTION OF THE REQUEST :
        Non-Java language runtimes sometimes interoperate with the JVM via JNI, starting the JVM via JNI_CreateJavaVM. R is one such language runtime (with its rJava package). This leads to issues when both language runtimes attempt to do stack overflow checking on the same (initial) thread. It would be nice to have an option to disable stack overflow checking (not insert guard pages) to the stack of the initial thread of the JVM

        JUSTIFICATION :
        In a way the initial thread is owned by the runtime that calls CreateJavaVM, the thread might have been created by it, and so the JVM should not take space from that thread's stack, not even space to insert guard pages. On Linux in Java 9 and older, the situation now is particularly bad as Java caps the stack size at 2M (inserts guard pages) no matter what the stack size established by rlimit is. The cap was a workaround for a bug in old Linux systems (JDK-4466587) and has been removed for Java 10 (in response to JDK-8170307). However, there is now a new cap of 8M for stack that is unlimited by rlimit. In theory, the language runtime that calls CreateJavaVM could set a finite rlimit before initializing the JVM, but really, simple option to disable the guard pages would be a lot simpler and cleaner solution. With such option, language runtimes calling CreateJavaVM would be unaffected by OS-specific workarounds for handling stack size and stack overflow in the JVM, which may indeed otherwise be needed for standalone use of Java.


          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  dholmes David Holmes
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: