Skip to content

Support Sandbox MaxCPUTime & MaxHeapMemory while using virtual threads #11058

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

Open
AhmedAbdelfaheem opened this issue Apr 22, 2025 · 0 comments
Assignees

Comments

@AhmedAbdelfaheem
Copy link

Describe GraalVM and your environment :

  • GraalVM version or commit id if built from source: 24.0
  • CE or EE: EE
  • JDK version: 21+
  • OS and OS Version: macOS Catalina
  • Architecture: [macOS]
  • The output of java -Xinternalversion:
ThreadMXBean.getThreadCpuTime() is not supported or enabled by the host VM but required for CPU time limit.

Have you verified this issue still happens when using the latest snapshot?
yes

Describe the issue
when i enable the virtual threads in my spring boot app while using the sandbox options MaxCPUTime & MaxHeapMemory i get the ThreadMXBean.getThreadCpuTime() is not supported or enabled by the host VM but required for CPU time limit.

Code snippet or code repository that reproduces the issue

 private Context buildGraalVMContext() {
        return Context
                .newBuilder(LANGUAGES)
                .allowExperimentalOptions(true)
                .allowAllAccess(true)
                .option("js.esm-eval-returns-exports", "true")
                .option("sandbox.MaxCPUTime", "%ds".formatted(timeoutSeconds))
                .option("sandbox.MaxHeapMemory", scriptMaxHeapSize)
                .allowIO(IOAccess.newBuilder()
                        .fileSystem(libraryFileSystem).build())
                .engine(engine).build();
    }

Steps to reproduce the issue
Please include both build steps as well as run steps

  1. Step one add the options MaxCPUTime & MaxHeapMemory when setup the graalvm context

Expected behavior
I expect to the context to get created and the eval run seamlessly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants