code review for attach on demand (AOD) fix for Windows (7028668)

Alan Bateman Alan.Bateman at
Fri Mar 18 02:14:45 PDT 2011

Daniel D. Daugherty wrote:
> Greetings,
> I have minor fixes to the Attach On Demand (AOD) Windows
> specific code that I'd like to get into T&L snapshot for
> OpenJDK7-B136 (next week):
> I'm adding more info to the default detail message for an
> OpenProcess() failure. I'm also getting a process handle
> in a different way when a Java process tries to attach to
> itself. If the new technique fails, then we fall back to
> the original OpenProcess() code.
> Thanks, in advance, for any comments.
> Dan
Can you elaborate more on why you are using DuplicateHandle when the 
target is the current process? It doesn't really make practical sense to 
attach to the current process but I realize there may be tests that do that.

I suspect you may be chasing a resource issue. If OpenProcess fails then 
ThrowIOExceptionWithLastError will attempt translate the error into a 
system message. I did a few tests and it does translate the errors as 
intended. In any case, putting the error code into the fallback system 
to help diagnose this seems reasonable to me.

Agree with Kelly on the sprintf.


More information about the hotspot-runtime-dev mailing list