Community
Participate
Working Groups
Build Identifier: 1.0.1 When I aquire multiple heap dumps and switch back and forth between them, initially it works fine, but after some time I get the NPE below. When I get it the first time it is consistently appearing until I restart MAT. eclipse.buildId=unknown java.version=1.6.0_23 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_AT Command-line arguments: -os win32 -ws win32 -arch x86_64 java.lang.NullPointerException at org.eclipse.mat.ui.snapshot.views.inspector.FieldsLabelProvider.getObjectLabel(FieldsLabelProvider.java:97) at org.eclipse.mat.ui.snapshot.views.inspector.FieldsLabelProvider.getColumnText(FieldsLabelProvider.java:85) at org.eclipse.jface.viewers.TableColumnViewerLabelProvider.update(TableColumnViewerLabelProvider.java:70) at org.eclipse.jface.viewers.ViewerColumn.refresh(ViewerColumn.java:145) at org.eclipse.jface.viewers.AbstractTableViewer.doUpdateItem(AbstractTableViewer.java:399) at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run(StructuredViewer.java:481) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.runtime.Platform.run(Platform.java:888) at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175) at org.eclipse.jface.viewers.StructuredViewer.updateItem(StructuredViewer.java:2111) at org.eclipse.jface.viewers.AbstractTableViewer.internalRefreshAll(AbstractTableViewer.java:752) at org.eclipse.jface.viewers.AbstractTableViewer.internalRefresh(AbstractTableViewer.java:649) at org.eclipse.jface.viewers.AbstractTableViewer.internalRefresh(AbstractTableViewer.java:636) at org.eclipse.jface.viewers.AbstractTableViewer$2.run(AbstractTableViewer.java:592) at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1392) at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1353) at org.eclipse.jface.viewers.AbstractTableViewer.inputChanged(AbstractTableViewer.java:590) at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:274) at org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:1634) at org.eclipse.mat.ui.snapshot.views.inspector.InspectorView$7$1.run(InspectorView.java:822) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3855) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3476) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.mat.ui.rcp.Application.start(Application.java:26) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514) at org.eclipse.equinox.launcher.Main.run(Main.java:1311) Reproducible: Sometimes Steps to Reproduce: 1. Start MAT 2. Aquire a few heapdumps 3. Play around with the various heapdumps open, switch between heapdumps, windows, Exception appears.
The line of code is this: IObject object = this.inspectorView.snapshot.getObject(this.inspectorView.snapshot .mapAddressToId(objectAddress)); inspectorView is a final field initialized at construction, so won't be the problem. My best guess is that snapshot is null, possibly by InspectorView.partClosed() Perhaps there is some race between closing a window and changing the fields display. Testing the snapshot for null might fix it, but there could be a chance of also getting the wrong snapshot. We need to understand the code more.
I usually get it when opening multiple heaps and playing around with them, i.e. open some views, e.g. dominator, details for certain objects and closing some of the views again. After it appeared once it consistently appears. It does not prevent any functionality as far as I see, it is just annoying as you need to close the dialog box that appears each time. I can take a memory dump of MAT itself from such a point if it helps!
I have seen a similar problem. I opened a PHD and an IBM system dump and clicked on a hash map in a dominator tree view on the system dump, but got a String displayed in the inspector view without any fields. I think this was from the PHD.
I have got a more reproducible error by modifying the job.schedule() in updateOnSelection() to job.schedule(1000L); then loading two different dumps, then open the dominator tree in both dumps, select an item in both trees and switch rapidly between the dumps using the dump tab. This can give: java.lang.ArrayIndexOutOfBoundsException at org.eclipse.mat.collect.BitField.get(BitField.java:61) at org.eclipse.mat.parser.internal.SnapshotImpl.isArray(SnapshotImpl.java:1423) at org.eclipse.mat.parser.internal.SnapshotImpl$HeapObjectCache.load(SnapshotImpl.java:2038) at org.eclipse.mat.parser.internal.SnapshotImpl$HeapObjectCache.load(SnapshotImpl.java:1) at org.eclipse.mat.parser.internal.snapshot.ObjectCache.get(ObjectCache.java:52) at org.eclipse.mat.parser.internal.SnapshotImpl.getObject(SnapshotImpl.java) at org.eclipse.mat.ui.snapshot.views.inspector.InspectorView$7.run(InspectorView.java:860) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) possibly because the snapshot has changed and the object id in one dump is not valid in the other. Perhaps we should save the snapshot id and check it is still the same when the job runs.
I've added code to avoid a stale snapshot in the inspector view.
I think the fix should solve the problem. If it reoccurs then please reopen this bug.