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 262571 - ArrayIndexOutOfBoundsException: 3436
Summary: ArrayIndexOutOfBoundsException: 3436
Status: VERIFIED FIXED
Alias: None
Product: profiler
Classification: Unclassified
Component: Engine (show other bugs)
Version: 8.2
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Hurka
URL:
Keywords:
: 267684 268119 269231 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-06-25 03:33 UTC by pangalz
Modified: 2016-12-13 13:52 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 224835


Attachments
stacktrace (1.94 KB, text/plain)
2016-06-25 03:33 UTC, pangalz
Details
Minimal test project (8.32 MB, application/zip)
2016-09-21 09:03 UTC, bolsover
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pangalz 2016-06-25 03:33:47 UTC
This bug was originally marked as duplicate of bug 208251, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.

Build: NetBeans IDE Dev (Build 201606240002)
VM: TuxJdk 64-Bit Server VM, 25.92-b03-tuxjdk-03, TuxJdk Runtime Environment, 1.8.0_92-tuxjdk-03
OS: Linux

User Comments:
pangalz: Running profiler




Stacktrace: 
java.lang.ArrayIndexOutOfBoundsException: 3436
   at org.netbeans.lib.profiler.instrumentation.SingleMethodScaner.getU4(SingleMethodScaner.java:189)
   at org.netbeans.lib.profiler.instrumentation.SingleMethodScaner.getInt(SingleMethodScaner.java:177)
   at org.netbeans.lib.profiler.instrumentation.Injector.changeJump(Injector.java:409)
   at org.netbeans.lib.profiler.instrumentation.Injector.changeJumps(Injector.java:526)
   at org.netbeans.lib.profiler.instrumentation.Injector.relocateCode(Injector.java:659)
   at org.netbeans.lib.profiler.instrumentation.Injector.injectCodeAndRewrite(Injector.java:328)
Comment 1 pangalz 2016-06-25 03:33:49 UTC
Created attachment 160163 [details]
stacktrace
Comment 2 Tomas Hurka 2016-06-28 09:11:49 UTC
Thanks for the report, however I need steps to reproduce it - it looks like that the exception depends on particular class file. What application did you profile?
Comment 3 pangalz 2016-06-29 23:26:33 UTC
I'll try with latest build and check if error still happens.
It occurred when I tried to attach in more than one app.
Comment 4 Tomas Hurka 2016-09-01 12:53:48 UTC
*** Bug 267684 has been marked as a duplicate of this bug. ***
Comment 5 Tomas Hurka 2016-09-20 14:15:05 UTC
*** Bug 268119 has been marked as a duplicate of this bug. ***
Comment 6 bolsover 2016-09-20 14:28:07 UTC
I see this and similar exceptions when running the SQL profiler against various projects - the common feature appears to be PervasiveSQL.  I do not think PervasiveSQL is a database formally supported by either Netbeans or Hibernate.

Running SQL Profiler against projects that use Hibernate in conjunction with MS SQLServer appears to work correctly.

Please let me know if i can offer any further information.

db
Comment 7 Tomas Hurka 2016-09-20 14:31:18 UTC
(In reply to bolsover from comment #6)
[..] 
> Please let me know if i can offer any further information.
Can you, please, provide step-by-step description, how to reproduce this exception? Thanks.
Comment 8 bolsover 2016-09-20 19:37:37 UTC
Hi Thomas

I have put together a minimal project to reproduce the exception - but I rather suspect it is of little value unless you have access to a PervasiveSQL database.

Let me know if you want a copy of the code I have now.

The code I have will reliably reproduce the following exception:

java.lang.ArrayIndexOutOfBoundsException: 6796
	at org.netbeans.lib.profiler.instrumentation.SingleMethodScaner.getU4(SingleMethodScaner.java:189)
	at org.netbeans.lib.profiler.instrumentation.SingleMethodScaner.getInt(SingleMethodScaner.java:177)
	at org.netbeans.lib.profiler.instrumentation.Injector.changeJump(Injector.java:409)
	at org.netbeans.lib.profiler.instrumentation.Injector.changeJumps(Injector.java:526)

I'll investigate further - but need some guidance on how to debug the ide.
Comment 9 Tomas Hurka 2016-09-21 07:26:30 UTC
(In reply to bolsover from comment #8)
> I have put together a minimal project to reproduce the exception - but I
> rather suspect it is of little value unless you have access to a
> PervasiveSQL database.
I am sorry, I don't know anything about PervasiveSQL. How can I get access to it? Maybe JDBC driver for PervasiveSQL will be enough to reproduce the problem.
Comment 10 bolsover 2016-09-21 09:03:38 UTC
Created attachment 162150 [details]
Minimal test project
Comment 11 bolsover 2016-09-21 09:09:55 UTC
I've uploaded a minimal test project to illustrate the problem.

The main class will run normally without the profiler but will throw the reported exception when it attempts to run the Hibernate generated queries. The normal JDBC queries run correctly and the profiler reports the SQL for these.

The PervasiveSQL driver is include in the /dist/lib folder together with a number of other libraries to allow Hibernate to run.

It might be possible to provide a public link (short term) to a PervasiveSQL database - let me know if you this this would be helpful.
Comment 12 Tomas Hurka 2016-09-21 13:58:12 UTC
Thanks for the test case. I am able to reproduce it with the following line:

Class.forName("com.pervasive.jdbc.v2.PreparedStatement");

added after Class.forName("com.pervasive.jdbc.v2.Driver"); statement.
Comment 13 Tomas Hurka 2016-09-21 19:34:19 UTC
Fixed in profiler-main

changeset:   300256:c580baffe8a9
user:        Tomas Hurka <thurka@netbeans.org>
date:        Wed Sep 21 21:26:26 2016 +0200
summary:     bugfix #262571, make sure injected code is aligned to 4 bytes - this way opc_tableswitch and opc_lookupswitch do not need to change padding
Comment 14 Quality Engineering 2016-09-23 02:01:09 UTC
Integrated into 'main-silver', will be available in build *201609230002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/c580baffe8a9
User: Tomas Hurka <thurka@netbeans.org>
Log: bugfix #262571, make sure injected code is aligned to 4 bytes - this way opc_tableswitch and opc_lookupswitch do not need to change padding
Comment 15 Tomas Hurka 2016-12-02 13:34:19 UTC
Fix transplanted to release82 branch:

changeset:   313492:8e8a463529b6
branch:      release82
parent:      313368:698929a0e5e1
user:        Tomas Hurka <thurka@netbeans.org>
date:        Wed Sep 21 21:26:26 2016 +0200
files:       lib.profiler/src/org/netbeans/lib/profiler/instrumentation/MethodEntryExitCallsInjector.java
description:
bugfix #262571, make sure injected code is aligned to 4 bytes - this way opc_tableswitch and opc_lookupswitch do not need to change padding
(transplanted from c580baffe8a905a0bdb133ec406d5f26285fcda7)
Comment 16 Tomas Hurka 2016-12-05 07:32:33 UTC
*** Bug 269231 has been marked as a duplicate of this bug. ***
Comment 17 bolsover 2016-12-13 11:28:07 UTC
Tested against 82 Patch1 - verified fixed.