Skip to content
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 Heap Dump fails on Java 17 due to inaccessible module: java.base/sun.nio.fs #87

Open
twhitmorenz opened this issue Dec 17, 2024 · 4 comments

Comments

@twhitmorenz
Copy link

Just installed MemoryAnalyzer-1.15 running on JDK 17, it fails when I try to open a heap dump. (No dialog/error shown visibly in the UI, just nothing happens, so it's fairly opaque to the user; however but an error can be seen in the Error Log.)

MemoryAnalyzer-1.15.0.20231206-win32.win32.x86_64.zip; was also happening with prior version MAT 1.14.0 which I had previously installed.
OpenJDK Runtime Environment Temurin-17.0.8+7 (build 17.0.8+7).

Could not run action: org.eclipse.mat.ui.snapshot.actions.OpenSnapshotAction

java.lang.reflect.InaccessibleObjectException: Unable to make boolean sun.nio.fs.WindowsFileAttributes.isDirectoryLink() accessible: module java.base does not "opens sun.nio.fs" to unnamed module @776d8097
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
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.core.internal.filesystem.local.nio.DosHandler.isDirectoryLink(DosHandler.java:80)
at org.eclipse.core.internal.filesystem.local.nio.DosHandler.fetchFileInfo(DosHandler.java:61)
at org.eclipse.core.internal.filesystem.local.LocalFileNativesManager.fetchFileInfo(LocalFileNativesManager.java:89)
at org.eclipse.core.internal.filesystem.local.LocalFile.fetchInfo(LocalFile.java:181)
at org.eclipse.core.filesystem.provider.FileStore.fetchInfo(FileStore.java:260)
at org.eclipse.core.internal.utils.FileUtil.realPath(FileUtil.java:136)
at org.eclipse.core.internal.utils.FileUtil.realURI(FileUtil.java:191)
at org.eclipse.core.internal.localstore.FileSystemResourceManager.setLocation(FileSystemResourceManager.java:1098)
at org.eclipse.core.internal.localstore.FileSystemResourceManager.getStoreRoot(FileSystemResourceManager.java:628)
at org.eclipse.core.internal.localstore.FileSystemResourceManager.locationURIFor(FileSystemResourceManager.java:866)
at org.eclipse.core.internal.localstore.FileSystemResourceManager.allPathsForLocationNonCanonical(FileSystemResourceManager.java:132)
at org.eclipse.core.internal.localstore.FileSystemResourceManager.allPathsForLocation(FileSystemResourceManager.java:120)
at org.eclipse.core.internal.localstore.FileSystemResourceManager.allResourcesFor(FileSystemResourceManager.java:279)
at org.eclipse.core.internal.resources.WorkspaceRoot.findFilesForLocationURI(WorkspaceRoot.java:110)
at org.eclipse.core.internal.resources.WorkspaceRoot.findFilesForLocationURI(WorkspaceRoot.java:103)
at org.eclipse.mat.ui.snapshot.actions.OpenSnapshotAction.getWorkspaceFile(OpenSnapshotAction.java:176)
at org.eclipse.mat.ui.snapshot.actions.OpenSnapshotAction.createEditorInput(OpenSnapshotAction.java:161)
at org.eclipse.mat.ui.snapshot.actions.OpenSnapshotAction.access$0(OpenSnapshotAction.java:157)
at org.eclipse.mat.ui.snapshot.actions.OpenSnapshotAction$1.visit(OpenSnapshotAction.java:73)
at org.eclipse.mat.ui.snapshot.OpenSnapshot$Visitor.go(OpenSnapshot.java:95)
at org.eclipse.mat.ui.snapshot.actions.OpenSnapshotAction.run(OpenSnapshotAction.java:87)
at org.eclipse.ui.internal.intro.impl.model.url.IntroURL.runAction(IntroURL.java:282)
at org.eclipse.ui.internal.intro.impl.model.url.IntroURL.doExecute(IntroURL.java:190)
at org.eclipse.ui.internal.intro.impl.model.url.IntroURL.lambda$0(IntroURL.java:145)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
at org.eclipse.ui.internal.intro.impl.model.url.IntroURL.execute(IntroURL.java:145)
at org.eclipse.ui.internal.intro.impl.presentations.BrowserIntroPartLocationListener.changing(BrowserIntroPartLocationListener.java:130)
at org.eclipse.swt.browser.IE.lambda$6(IE.java:525)
at org.eclipse.swt.ole.win32.OleEventTable.sendEvent(OleEventTable.java:57)
at org.eclipse.swt.ole.win32.OleEventSink.notifyListener(OleEventSink.java:160)
at org.eclipse.swt.ole.win32.OleEventSink.Invoke(OleEventSink.java:128)
at org.eclipse.swt.ole.win32.OleEventSink$1.method6(OleEventSink.java:79)
at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:120)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(Native Method)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:342)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:648)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:342)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:555)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173)
at org.eclipse.mat.ui.rcp.Application.start(Application.java:28)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
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:651)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:588)
at org.eclipse.equinox.launcher.Main.run(Main.java:1459)

I am running OpenJDK 17.

Eventually with difficulty I found a workaround -- add the following to MemoryAnalyzer.ini after the -vmargs line.
--add-opens=java.base/sun.nio.fs=ALL-UNNAMED


I would perhaps also suggest this to be added to the Eclipse MAT FAQ, https://wiki.eclipse.org/MemoryAnalyzer/FAQ however this page seems to be deprecated/ read only. The documentation page https://eclipse.dev/mat/documentation/ links a new URL http://wiki.eclipse.org/index.php/MemoryAnalyzer/FAQ for the FAQ but this doesn't yet work.

@kgibm
Copy link
Member

kgibm commented Dec 17, 2024

It seems this is related to Windows symbolic links and the Eclipse platform using an internal Java API. Do you get the same issue with a snapshot build? https://www.eclipse.org/downloads/download.php?file=/mat/snapshots/rcp/org.eclipse.mat.ui.rcp.MemoryAnalyzer-win32.win32.x86_64.zip

@twhitmorenz
Copy link
Author

twhitmorenz commented Dec 17, 2024

I've tried using the snapshot -- it opens the dump fine & doesn't have/need the 'add-opens' in the ini file. Works perfectly. Thanks so much for the suggestion!

Let me know if there's anything easy I can do (quick PR) to add something to an FAQ or docs, so the wrinkle & workaround are documented for those using the release.

@kgibm
Copy link
Member

kgibm commented Dec 17, 2024

Thanks, I think what happened is that Java 17 changed the module requirements which broke older versions of Eclipse, but our latest snapshot builds use newer version of Eclipse which avoid using the deprecated Java APIs. We are about to build MAT 1.16 and publish that as the main release, so this should avoid this issue. Thank you for bringing it up.

@krumts FYI, here's an issue that seems to be fixed in MAT 1.16 and also it seems there's a broken link to the old FAQ.

krumts added a commit to eclipse-mat/website that referenced this issue Dec 18, 2024
@krumts
Copy link
Contributor

krumts commented Dec 18, 2024

@twhitmorenz thanks for reporting this and offering help!
For now I fixed the broken link to the FAQ, as after the recent change to how the MAT website is deployed I haven't got the chance yet to document it well. But spotting and reporting the issue already helped!

About extending the FAQs - another change which happened is that the Eclipse Wiki got deprecated and the content there -read-only. We started moving the content (#49) but there is still a lot more to do, FAQs are one of the pieces to move.

So, I agree that it would be helpful to add to the FAQs the description of the issue, that it would be solved with MAT 1.16.0 and that there is a workaround for the older versions, but at present we cannot update them :(
I'll keep this issue open as a reminder to update the FAQs once we have moved them to a writable location.

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

No branches or pull requests

3 participants