This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 104573 - Very large method causes ArrayIndexOutOfBoundsException
Summary: Very large method causes ArrayIndexOutOfBoundsException
Status: RESOLVED FIXED
Alias: None
Product: profiler
Classification: Unclassified
Component: Base (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Tomas Hurka
URL:
Keywords:
: 104571 104572 130472 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-05-23 05:52 UTC by apb
Modified: 2008-08-19 14:22 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
messages.log (116.34 KB, text/plain)
2007-06-08 18:47 UTC, patrick133t
Details
Class file with large _jspService method (253.43 KB, application/octet-stream)
2007-06-08 20:41 UTC, patrick133t
Details

Note You need to log in before you can comment on or make changes to this bug.
Description apb 2007-05-23 05:53:23 UTC
I have a very large project and every single time I try to run a memory profile
on it, the profiler crashes in netbeans when it instruments the 3,435th class.
This happen under Suse 10.1 64 bit and under Windows XP 64 bit with both Java
1.6.0 and 1.6.0_1 (I haven't tried it on any other platforms).

Here is the error:

java.lang.ArrayIndexOutOfBoundsException
	at java.lang.System.arraycopy(Native Method)
	at
com.sun.tools.profiler.instrumentation.SingleMethodScaner.initBytecodesArray(SingleMethodScaner.java:147)
	at
com.sun.tools.profiler.instrumentation.SingleMethodScaner.setClassAndMethod(SingleMethodScaner.java:42)
	at
com.sun.tools.profiler.instrumentation.MemoryProfMethodInstrumentor.hasNewOpcodes(MemoryProfMethodInstrumentor.java:125)
	at
com.sun.tools.profiler.instrumentation.ObjLivenessMethodInstrumentor.methodNeedsInstrumentation(ObjLivenessMethodInstrumentor.java:42)
	at
com.sun.tools.profiler.instrumentation.MemoryProfMethodInstrumentor.findAndMarkMethodsToInstrumentInClass(MemoryProfMethodInstrumentor.java:107)
	at
com.sun.tools.profiler.instrumentation.MemoryProfMethodInstrumentor.getMethodsToInstrumentUponClassLoad(MemoryProfMethodInstrumentor.java:71)
	at
com.sun.tools.profiler.instrumentation.Instrumentor.createFollowUpInstrumentMethodGroupResponseForMemoryProfiling(Instrumentor.java:463)
	at
com.sun.tools.profiler.instrumentation.Instrumentor.createFollowUpInstrumentMethodGroupResponse(Instrumentor.java:157)
	at
com.sun.tools.profiler.ProfilerClient.instrumentMethodGroupFollowUp(ProfilerClient.java:901)
	at com.sun.tools.profiler.ProfilerClient.access$2900(ProfilerClient.java:46)
[catch] at
com.sun.tools.profiler.ProfilerClient$SeparateCmdExecutionThread.run(ProfilerClient.java:1603)
Comment 1 apb 2007-05-23 05:59:38 UTC
*** Issue 104571 has been marked as a duplicate of this issue. ***
Comment 2 apb 2007-05-23 05:59:49 UTC
*** Issue 104572 has been marked as a duplicate of this issue. ***
Comment 3 apb 2007-05-25 19:25:55 UTC
I just tried it out in Netbeans 5.5.1 with the 5.5.1 profiler and did not get
the error.
Comment 4 apb 2007-06-03 20:19:00 UTC
5.5.1 of the profiler fixed the issue under Linux but the exact same error
remains under Window XP 64.
Comment 5 Tomas Hurka 2007-06-04 11:15:29 UTC
Please provide more information. Attach NetBeans IDE message.log (<nb_user_home>/var/log/
messages.log), console output from profiled application whould be also handy. Are you able to prepare 
reproducible test case? Thanks.
Comment 6 patrick133t 2007-06-08 18:45:13 UTC
I see this one, too. I am running 5.5.1 on Linux (32-bit) with Sun JDK 1.6.0_01.

I have attached my messages.log.
Comment 7 patrick133t 2007-06-08 18:47:22 UTC
Created attachment 43452 [details]
messages.log
Comment 8 patrick133t 2007-06-08 20:40:29 UTC
I've kept at this one and found that it's a problem with ClassInfo and
ClassFileParser using char variables for lengths and offsets that can exceed
65536 bytes. I have attached the classfile that causes the problem. It's
_jspService methodInfoLength is 91859, which when truncated to a char is less
than the bytecode length of 57223, which ultimately results in the
ArrayIndexOutOfBoundsException.
Comment 9 patrick133t 2007-06-08 20:41:18 UTC
Created attachment 43456 [details]
Class file with large _jspService method
Comment 10 Tomas Hurka 2007-06-11 08:52:05 UTC
Thanks for catching this patrick133t. You are right, this huge classfile is the root of the problem. Lowering 
priority to P2.
Comment 11 Tomas Hurka 2007-06-11 10:01:42 UTC
Fixed in trunk.
Comment 12 Alexander Kouznetsov 2007-09-10 15:07:17 UTC
apb, patrick133t, could you please verify this issue?
Comment 13 Tomas Hurka 2008-08-19 14:22:56 UTC
*** Issue 130472 has been marked as a duplicate of this issue. ***