Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Memory Analyzer » What would you do if you could run code on heap dumps?
What would you do if you could run code on heap dumps? [message #1063908] Fri, 14 June 2013 19:14 Go to next message
Robin Salkeld is currently offline Robin Salkeld
Messages: 8
Registered: June 2013
Junior Member
Hello all,

I'll admit right off the bat that this is something of an odd post. Smile

I'm a PhD candidate at the University of British Columbia, and as part of my dissertation project I've built a kind of JVM emulator library which is able to simulate executing code without an actual live JVM. In particular, this makes it possible to run code on a heap dump as if it's a live process.

I've created Eclipse MAT plugins using this library that adds features like an "evaluate expression" query and executing the toString() method instead of using class specific name resolvers. I've had a paper on this conditionally accepted at OOPSLA this year, but I'm trying to come up with a "real life" example/case study of using this tool to debug or analyze heap dumps.

Can any of you can think of any situations in the past or present where having this ability would have been useful? Any and all wild ideas are welcome, especially if you know of a past bug where this ability would have helped diagnose it faster/more easily.

If anyone's interested I can make the plugins available for download - although they are still very much research-quality they are surprisingly usable. Smile

Thanks very much!

Robin Salkeld
Re: What would you do if you could run code on heap dumps? [message #1063961 is a reply to message #1063908] Sun, 16 June 2013 16:18 Go to previous messageGo to next message
Andrew Johnson is currently offline Andrew Johnson
Messages: 119
Registered: July 2009
Senior Member
This sounds interesting, though presumably you need access to the program jars as the heap dumps don't have full class file information.

These two posts show requests for something similar.
OQL: calling Java methods
OQL: how to define JS functions

The Eclipse debugger appears to evaluate toString() to inspect objects, perhaps it actually executes the code.

Andrew Johnson
Re: What would you do if you could run code on heap dumps? [message #1063965 is a reply to message #1063961] Sun, 16 June 2013 18:23 Go to previous messageGo to next message
Robin Salkeld is currently offline Robin Salkeld
Messages: 8
Registered: June 2013
Junior Member
Andrew Johnson wrote on Sun, 16 June 2013 16:18
This sounds interesting, though presumably you need access to the program jars as the heap dumps don't have full class file information.


Definitely, and part of the configuration of the virtual JVM is how directories in the original VM map to local directories, so it can locate the class files as needed.

Andrew Johnson wrote on Sun, 16 June 2013 16:18
These two posts show requests for something similar.
OQL: calling Java methods
OQL: how to define JS functions


I saw those threads earlier - thanks for the reminder. I'll post there as well in case there's interest.

Andrew Johnson wrote on Sun, 16 June 2013 16:18
The Eclipse debugger appears to evaluate toString() to inspect objects, perhaps it actually executes the code.


Yup, that's exactly how it works, and why you can't *normally* evaluate toString() without a live process.
Re: What would you do if you could run code on heap dumps? [message #1065571 is a reply to message #1063965] Wed, 26 June 2013 10:23 Go to previous messageGo to next message
Krum Tsvetkov is currently offline Krum Tsvetkov
Messages: 149
Registered: July 2009
Senior Member
Hi Robin,

Sorry for the late reply. Your research definitely sounds interesting.
I spent some time thinking of possible problems where this could have simplified the analysis, but it is difficult without having a concrete problem at the moment (this is when one gets creative Smile ).

I think toString() definitely helps a lot. This is why we have introduced the NameResolvers in MAT. We used them for example to determine the name of a bundle/application based on the ClassLoader, to get more details about content of (big) objects.

I think one area where your tool could be helpful is request related problems, for example problems where one single request/activity caused an OOM error. For such issues we have in MAT the RequestResolver extension, but the implementation is very specific for every server, every object to be inspected. We are trying to guess based on the objects on the thread's stack what the thread was doing and extract some details about it.

With your tools it would be possible (I guess) to inspect the request objects of any http server, for example:
- Get the session id
- List request parameters
- Get request headers
and by this learn more about the conditions under which the problem occurred.

The example above was more from my experience with a web server, where the starting point is a HttpRequest. But I think this is applicable for other activities also. Another example that comes to my mind is to examine (without dedicated MAT extensions) the details of a background task like an Eclipse scheduled jobs which caused a problem.

I hope this can give you some ideas for your real-life example.

Re: What would you do if you could run code on heap dumps? [message #1069360 is a reply to message #1065571] Mon, 15 July 2013 14:38 Go to previous messageGo to next message
Robin Salkeld is currently offline Robin Salkeld
Messages: 8
Registered: June 2013
Junior Member
Hi Krum,

Thanks very much for the detailed reply! There are definitely some good potential paths there.

I actually ended up using the tool to diagnose this bug in the Eclipse CDT plugins, which worked out very well:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=400073

I'm hoping to take some time after my paper is away to make my tool easily downloadable by end users, since there have been a couple of requests for it.

Thanks again!

Robin

Re: What would you do if you could run code on heap dumps? [message #1108402 is a reply to message #1069360] Fri, 13 September 2013 16:11 Go to previous message
Robin Salkeld is currently offline Robin Salkeld
Messages: 8
Registered: June 2013
Junior Member
Hi all,

I'm happy to say that I've made my tool available for installation into Eclipse, if anyone is interested. It adds a few additional custom queries to the Memory Analyzer tool.

https://github.com/robinsalkeld/retrospect/

I've done my best to document the basics but it's still very much a research prototype. Smile The technique is described in detail in my upcoming OOPSLA paper: Interacting with Dead Objects.

Enjoy, and don't hesitate to contact me for help or feedback! My email address is rsalkeld "at" cs.ubc.ca.

Cheers,
Robin
Previous Topic:OQL: how to define JS functions
Next Topic:Which algrithm is used for dominator tree calculation?
Goto Forum:
  


Current Time: Fri Aug 22 17:40:26 EDT 2014

Powered by FUDForum. Page generated in 0.02276 seconds