0

I'm using NVIDIA's Visual Profiler (nvvp) to profile a kernel on a Pascal GPU (as those aren't supported by Nsight Compute) - with CUDA 11.4 on a Devuan GNU/Linux 4 system.

When I run nvvp, it crashes immediately, saying:

$ nvvp
java.lang.ExceptionInInitializerError
    at org.eclipse.osgi.storage.Storage.<init>(Storage.java:97)
    at org.eclipse.osgi.storage.Storage.createStorage(Storage.java:84)
    at org.eclipse.osgi.internal.framework.EquinoxContainer.<init>(EquinoxContainer.java:75)
    at org.eclipse.osgi.launch.Equinox.<init>(Equinox.java:31)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:295)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:231)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected void java.net.URLClassLoader.addURL(java.net.URL) accessible: module java.base does not "opens java.net" to unnamed module @21bcffb5
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
    at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
    at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
    at org.eclipse.osgi.storage.FrameworkExtensionInstaller.findMethod(FrameworkExtensionInstaller.java:52)
    at org.eclipse.osgi.storage.FrameworkExtensionInstaller.findMethod(FrameworkExtensionInstaller.java:59)
    at org.eclipse.osgi.storage.FrameworkExtensionInstaller.findAddURLMethod(FrameworkExtensionInstaller.java:43)
    at org.eclipse.osgi.storage.FrameworkExtensionInstaller.<clinit>(FrameworkExtensionInstaller.java:37)
    ... 14 more

Why is this happening, and how can I circumvent/fix this error?

Edit: On my system, the default JAVA VM is: openjdk 17-ea 2021-09-14. If I use a different installed vm, e.g. /usr/lib/jvm/java-11-openjdk-amd64/bin/java, I get the same error. A JDK from https://jdk.java.net/archive/ for Java 16 also doesn't change things. Adding --illegal-access=permit which someone suggested to me - also didn't help.

einpoklum
  • 118,144
  • 57
  • 340
  • 684
  • If that code is based on an old version of Eclipse it is [this issue](https://bugs.eclipse.org/bugs/show_bug.cgi?id=502108) which is fixed in later versions of Eclipse. You probably need to use Java 8 to run that code unchanged. – greg-449 Oct 17 '21 at 10:06
  • @greg-449: Yes, I'm pretty sure it's based on an old version of Eclipse. I doubt I need to go back all the way to Java 8, but yes, howlger suggested downgrading the Java version. – einpoklum Oct 17 '21 at 10:12
  • That bug report says the problem was caused by the changes in Java 9 – greg-449 Oct 17 '21 at 10:13
  • @greg-449: In that case, I hope it's not that specific bug. I was running nvvp successfully just a couple of years back, after all. – einpoklum Oct 17 '21 at 10:14

1 Answers1

1

The InaccessibleObjectException seems to be caused by using Java 17 to run Java code that is not ready for Java 17. Java 17 is more restrictive than previous Java versions, breaking backwards compatibility in this point. Also Java 16 is more restrictive than previous versions and in the Java 11 system library packages are missing that existed in Java 8.

Instead of Java 17, use Java 16 or 11 to run an application based on a recent Eclipse version (having --add-modules=ALL-SYSTEM in the .ini file) and Java 8 for applications based on older Eclipse versions.

In the .ini file next to the executable (having the same name) you can specify the Java to be used to run the Eclipse-based application. Alternatively, you can put the Java in the jre subdirectory of the installation directory.

In addition, you might ask the vendor of the application to ship the application with an embedded Java.

Update: Robert Crovella refers to the documentation, according to which the ​Visual Profiler requires Java 8.

howlger
  • 31,050
  • 11
  • 59
  • 99
  • Can you link to a description of how to do that without "messing" with other apps on my system which expect Java 17? – einpoklum Oct 17 '21 at 08:07
  • Does installing _JustJ OpenJDK Hotspot JRE Complete_ via _Help > Install New Software..._ working with the update site [`https://download.eclipse.org/justj/jres/16/updates/release/`](https://download.eclipse.org/justj/jres/16/updates/release/) work for you? – howlger Oct 17 '21 at 08:18
  • "Help" of what? Remember I can't run the visual profiler app. Also, on machines where it does run, the Help menu doesn't have an "Install New Software" entry. – einpoklum Oct 17 '21 at 09:02
  • 1
    I see. I don't know NVIDIA Visual Profiler, but it seems to be an Eclipse RCP application. So there should be an [`.ini` file next to the executable where you can specify the Javato be used to run it](https://wiki.eclipse.org/Eclipse.ini#Specifying_the_JVM). – howlger Oct 17 '21 at 10:20
  • Ok, so - this doesn't work. I tried to follow your advice with the more specific instructions in the answer I posted, and - I got the same error still. See question edit. – einpoklum Oct 18 '21 at 09:39
  • Did you try Java 16, 11 and 8? See my edited answer. For what reason did you add your own answer, which is more specific and doesn't work because it is more specific? – howlger Oct 18 '21 at 10:19
  • I tried 11 and 16.01 . I added my answer because I was sure it would work. But... then it didn't. Deleted it for now. – einpoklum Oct 18 '21 at 12:36
  • Then try Java 8, especially if there was no `--add-modules=ALL-SYSTEM` in the .ini file. You can download a Java 8 JRE (a JRE instead of full JDK should be enough) e.g. [here as ZIP](https://adoptopenjdk.net/archive.html?variant=openjdk8). – howlger Oct 18 '21 at 16:27
  • I'll try this, but it's unlikely this will work, since this version of NVVP wasreleased way, way later than when Java 8 was the current version. – einpoklum Oct 18 '21 at 16:46
  • Java 9 and 10 were not long-term support (LTS) versions and Java 11 was released in September 2018. So many skipped Java 9 and 10. When running with a too old Java version, you will get an _UnsupportedClassVersionError_ telling the version with which it was compiled. Since Java 9 best practice is not anymore to install the latest version into your system, but embed the right and minimal (created via `jlink`) Java VM into the application. – howlger Oct 18 '21 at 18:33
  • 1
    The visual profiler requires [a specific version of JRE](https://docs.nvidia.com/cuda/profiler-users-guide/index.html#setup-jre). – Robert Crovella Oct 28 '21 at 14:25
  • @RobertCrovella Thx for the link to the documentation. I added it to the answer. – howlger Oct 28 '21 at 17:48