United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7176856 add the JRE name to the error log
JDK-7176856 : add the JRE name to the error log

Details
Type:
Enhancement
Submit Date:
2012-06-14
Status:
Closed
Updated Date:
2014-02-04
Project Name:
JDK
Resolved Date:
2012-07-03
Component:
hotspot
OS:
generic
Sub-Component:
runtime
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
hs23
Fixed Versions:
hs24 (b15)

Related Reports
Backport:
Backport:
Backport:
Backport:

Sub Tasks

Description
http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2012-May/003703.html

Kirs Mok wrote:

Hi all,

Could I get some review for this change, please?
https://gist.github.com/2709918#file_jre_name.patch
I'm considering this as an initial draft version, and will improve it later
on
based on comments received.

Background:

An earlier case on hotspot-dev [1][2] seemed to have hit a bug caused by
mix-
matching an Oracle JRE with a OpenJDK-based HotSpot VM.

Chris suggested [3] that, to better aid future analysis of similar problems,
it's useful to print the JRE name in the error log, in addition to the JRE
version as printed currently. This patch implements Chris' suggestion.

An example of the effect of this patch is avaiable [4].

There are a few details that I'm not too sure about yet, and I'm looking for
comments on them:

1. How and when should I get the JRE name?

The JRE name is only exposed as a field of a Java-level class, namely the
"java_runtime_name" constant field in sun.misc.Version. I couldn't find it
exposed anywhere else. It is set into the Java-level system properties, by
the
key "java.runtime.name", but that's not immediately available to the VM
side.

In my patch, I'm fetching the JRE name from
sun.misc.Version.java_runtime_name
immediately after java.lang.System.initializeSystemClass() is invoked, and
then
storing it in a static field in JDK_Version. This is safer to do then
fetching
the name during error reporting, because it may be unreliable to access Java
heap contents when the VM is crashing.

There are other alternatives that I've thought about. One is adding a new
private interface between JDK/JVM that would allow the JDK to expose its
name
to the VM directly, perhaps with a new function JDK_GetName0(). But this is
more involved then the proposed change.

2. Where should I store the JRE name?

As mentioned, I'm storing it in a newly added static field in JDK_Version
right
now. But I'm not sure if this is the place it belongs. Universe doesn't seem
like the right place, neither.

Any suggestions or comments are welcomed.

Should I cc serviceability-dev as well?

Regards,
Kris

                                    

Comments
EVALUATION

Yes
                                     
2012-06-14
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/f8de958e5b2c
                                     
2012-06-18
EVALUATION

http://hg.openjdk.java.net/lambda/lambda/hotspot/rev/f8de958e5b2c
                                     
2012-06-29



Hardware and Software, Engineered to Work Together