JDK-5008129 : VMObjectAllocation and GetObjectSize return different sizes for the same object
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2004-03-04
  • Updated: 2004-03-29
  • Resolved: 2004-03-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 b43Fixed
Related Reports
Relates :  
Description

Name: dkR10014			Date: 03/04/2004


--------------------------------------
Tests       : nsk/jvmti/scenarios/allocation/AP11/ap11t001
VM          : ClientVM, ServerVM
Mode        : all
Platform    : generic
OS          : generic
JDK         : 1.5.0 b41
----------------------------------------

The test agent enables VMObjectAllocation event. For every
received event the agent performs various checks against
actual parameters passed in to the callback.
In particular, it checks that size of the allocated
object is equal to size returned by GetObjectSize function.

Below is excerpt from test's output:
-------------------------------------------------------------------------------
bash-2.03$ sh run.sh /export/ld24/java/hotspot/jdk1.5/solsparc -v
Run: nsk/jvmti/scenarios/allocation/AP11/ap11t001
- ap11t001.c, 200: Timeout: 120000 msc
- ap11t001.c, 82: VMObjectAlloc in "main" thread: "Ljava/security/AccessControlContext;"
# ERROR: ap11t001.c, 161: VMObjectAlloc: inconsistent object size data
         size passed in to callback: 6
         size returned by GetObjectSize: 24

- ap11t001.c, 82: VMObjectAlloc in "main" thread: "Ljava/security/AccessControlContext;"
# ERROR: ap11t001.c, 161: VMObjectAlloc: inconsistent object size data
         size passed in to callback: 6
         size returned by GetObjectSize: 24

- ap11t001.c, 82: VMObjectAlloc in "main" thread: "Ljava/security/AccessControlContext;"
# ERROR: ap11t001.c, 161: VMObjectAlloc: inconsistent object size data
         size passed in to callback: 6
         size returned by GetObjectSize: 24

....
Sync: debuggee started
- ap11t001.c, 82: VMObjectAlloc in "main" thread: "[Ljava/security/ProtectionDomain;"
# ERROR: ap11t001.c, 161: VMObjectAlloc: inconsistent object size data
         size passed in to callback: 4
         size returned by GetObjectSize: 16

- ap11t001.c, 82: VMObjectAlloc in "main" thread: "Ljava/security/AccessControlContext;"
# ERROR: ap11t001.c, 161: VMObjectAlloc: inconsistent object size data
         size passed in to callback: 6
         size returned by GetObjectSize: 24

Java exit code: 97
bash-2.03$ 
-------------------------------------------------------------------------------

Steps to reproduce the failure:

  cd /net/jano.sfbay/export/disk20/GammaBase/Bugs/<this bug number>
  sh build.sh $JAVA_HOME  [-g] [-d64]
  sh run.sh $JAVA_HOME [-g] [-v] [JAVA_OPTS]
where
    -d64   - build for 64-bit solaris-sparcv9
    -g     - build for or run with java_g binaries
    -v     - run in verbose mode

The tests will be available in next r27 release of testbase.

======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger-beta2 FIXED IN: tiger-beta2 INTEGRATED IN: tiger-b43 tiger-beta2 VERIFIED IN: tiger-beta2
14-06-2004

SUGGESTED FIX ------- jvmtiExport.cpp ------- *** /tmp/sccs.0gaq9D Mon Mar 8 08:50:15 2004 --- jvmtiExport.cpp Fri Mar 5 12:14:14 2004 *************** *** 253,259 **** public: JvmtiVMObjectAllocEventMark(JavaThread *thread, oop obj) : JvmtiClassEventMark(thread, oop_to_klassOop(obj)) { _jobj = (jobject)to_jobject(obj); ! _size = obj->size(); }; jobject jni_jobject() { return _jobj; } jint size() { return _size; } --- 253,259 ---- public: JvmtiVMObjectAllocEventMark(JavaThread *thread, oop obj) : JvmtiClassEventMark(thread, oop_to_klassOop(obj)) { _jobj = (jobject)to_jobject(obj); ! _size = obj->size() * wordSize; }; jobject jni_jobject() { return _jobj; } jint size() { return _size; } ###@###.### 2004-03-08
08-03-2004

EVALUATION The event is returning the object size in words whereas GetObjectSize is returning the size in bytes. Easily fixed. ###@###.### 2004-03-04
04-03-2004