| Summary: | NullPointerException when switching between multiple open heaps | ||
|---|---|---|---|
| Product: | [Tools] MAT | Reporter: | Dominik Stadler <dominik.stadler> |
| Component: | GUI | Assignee: | Andrew Johnson <andrew_johnson> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | andrew_johnson |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
Dominik Stadler
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. |