-
Notifications
You must be signed in to change notification settings - Fork 308
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
Polyglot Sampler doesn't work with GraalVM for JDK 21 #537
Comments
Please provide steps to reproduce. How do I run python or javascript? |
I guess this can be reproduced with any Truffle application. Originally I tried to use the sampler with Enso, but I can also reproduce it with my graal.js websocket repository:
that launches a JVM app with Graal.js. Then I connect to it via VisualVM and get the above mentioned exception. Here is even simpler application: diff --git pom.xml pom.xml
new file mode 100644
index 0000000..94316f3
--- /dev/null
+++ pom.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>cz.xelfi.demo</groupId>
+ <artifactId>jsdemo</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.source>11</maven.compiler.source>
+ <maven.compiler.target>11</maven.compiler.target>
+ <exec.mainClass>cz.xelfi.demo.jsdemo.Jsdemo</exec.mainClass>
+ <graalvm.version>23.1.1</graalvm.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.graalvm.polyglot</groupId>
+ <artifactId>polyglot</artifactId>
+ <version>${graalvm.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.graalvm.polyglot</groupId>
+ <artifactId>js</artifactId>
+ <version>${graalvm.version}</version>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
diff --git src/main/java/cz/xelfi/demo/jsdemo/Jsdemo.java src/main/java/cz/xelfi/demo/jsdemo/Jsdemo.java
new file mode 100644
index 0000000..a5f840c
--- /dev/null
+++ src/main/java/cz/xelfi/demo/jsdemo/Jsdemo.java
@@ -0,0 +1,14 @@
+package cz.xelfi.demo.jsdemo;
+
+import org.graalvm.polyglot.Context;
+
+public class Jsdemo {
+
+ public static void main(String[] args) throws Exception {
+ var ctx = Context.create("js");
+ for (var i = 0; ; i++) {
+ ctx.eval("js", "print('Hi " + i + " times');");
+ Thread.sleep(100);
+ }
+ }
+} |
FYI: JVM Standalone from https://github.com/oracle/graaljs/releases/tag/graal-23.1.1 works fine. |
Probably because there is |
It looks to me that the above test application is missing some dependencies, since I am not able to find |
Do you mean this CPUSampler? That one seems to be available in org.graalvm.tool:profiler-tool package.
Do you mean that without the |
Right.
Yes, this needs to be fixed, but the fix for CNFE will not help if |
Please update the testcase above. The tescase will never work without this dependency. |
Thanks. This looks OK, however there is still some classloader mismatch. :-( |
It looks like there is clash between classpath and module-path.
prints
The solution would be to use only JPMS modules, since all maven dependecies are in fact JPMS modules. |
There are two ways to use Truffle Unchained.
It'd be ideal to support both: Just tell me what version/commit of VisualVM I need and what modules to include. Thank you. |
AFAICT |
Hello Tomáši. I can confirm I can debug latest version of Enso with your custom VisualVM build. Thank you. I've noticed that there are strange messages being printed on console when the VisualVM is attached:
is that expected in the custom build? |
OK. I need to do some more testing and I will fix it in master shortly.
Yes, this is part of the debug output. |
Classpath case should be fixed by just released GraalVM 23.1.2. |
What am I supposed to do to verify the fix, Tomáši?
Thank you for your guidance. I tried enso-org/enso#8883 with VisualVM 2.1.6 but I don't think the polyglot sampler is working. The exception is the same #537 (comment) as originally reported. |
You already verified it. Here: #537 (comment) . |
Describe the bug
I seem to be unable to use polyglot sampler with GraalVM 23.1 for JDK 21. My application puts Truffle as well as some libraries on
--module-path
, VisualVM 2.1.6 or 2.1.7 can open the application and shows "Polyglot Sampler" tab. But when switching to it, no button is enabled. I see following exception on console of my application:I guess that's the cause. Btw. looks like that
GraalVMLocator
is gone in GraalVM for JDK 21. The class probably no longer exists.To Reproduce
Steps to reproduce the behavior:
Expected behavior
It'd be nice if polyglot sampling worked again with latest GraalVM.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: