h2database / h2database/h2database

TestCrashAPI: IOOBE in CommandContainer.recompileIfRequired()

Open
#2,616 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
4.6k
Forks
1.3k
Avg merge
1d 2h
Merged PRs (30d)
9

Description

ERROR: new TestCrashAPI().init(test).testCase(1738703645); // Bug 466845879 id=1241 callCount=1213 openCount=10 General error: "java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0"; SQL statement:
1117SHOW COLUMNS FROM TEST_P [50000-200] org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0"; SQL statement:
1118SHOW COLUMNS FROM TEST_P [50000-200] ------------------------------
1119org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0"; SQL statement:
1120SHOW COLUMNS FROM TEST_P [50000-200]
1121	at org.h2.message.DbException.getJdbcSQLException(DbException.java:511)
1122	at org.h2.message.DbException.getJdbcSQLException(DbException.java:435)
1123	at org.h2.message.DbException.get(DbException.java:189)
1124	at org.h2.message.DbException.convert(DbException.java:353)
1125	at org.h2.command.Command.executeQuery(Command.java:210)
1126	at org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:111)
1127	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
1128	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
1129	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
1130	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
1131	at org.h2.test.synth.TestCrashAPI.callRandom(TestCrashAPI.java:395)
1132	at org.h2.test.synth.TestCrashAPI.testCase(TestCrashAPI.java:349)
1133	at org.h2.test.synth.TestCrashAPI.test(TestCrashAPI.java:176)
1134	at org.h2.test.TestBase.runTest(TestBase.java:141)
1135	at org.h2.test.TestAll.addTest(TestAll.java:988)
1136	at org.h2.test.TestAll.test(TestAll.java:816)
1137	at org.h2.test.TestAll.runTests(TestAll.java:616)
1138	at org.h2.test.TestAll.testAll(TestAll.java:546)
1139	at org.h2.test.TestAll.run(TestAll.java:496)
1140	at org.h2.test.TestAll.main(TestAll.java:438)
1141Caused by: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
1142	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
1143	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
1144	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
1145	at java.base/java.util.Objects.checkIndex(Objects.java:372)
1146	at java.base/java.util.ArrayList.get(ArrayList.java:458)
1147	at org.h2.command.CommandContainer.recompileIfRequired(CommandContainer.java:147)
1148	at org.h2.command.CommandContainer.query(CommandContainer.java:258)
1149	at org.h2.command.Command.executeQuery(Command.java:189)
1150	... 15 more
115109:31:12 00:06.563 org.h2.test.synth.TestCrashAPI FAIL java.lang.RuntimeException: org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0"; SQL statement:
1152SHOW COLUMNS FROM TEST_P [50000-200]
1153ERROR: FAIL (lazy mvStore memory ) java.lang.RuntimeException: org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0"; SQL statement:
1154SHOW COLUMNS FROM TEST_P [50000-200] java.lang.RuntimeException: org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0"; SQL statement:
1155SHOW COLUMNS FROM TEST_P [50000-200] ------------------------------
1156java.lang.RuntimeException: org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0"; SQL statement:
1157SHOW COLUMNS FROM TEST_P [50000-200]
1158	at org.h2.test.synth.TestCrashAPI.printError(TestCrashAPI.java:378)
1159	at org.h2.test.synth.TestCrashAPI.printIfBad(TestCrashAPI.java:438)
1160	at org.h2.test.synth.TestCrashAPI.callRandom(TestCrashAPI.java:400)
1161	at org.h2.test.synth.TestCrashAPI.testCase(TestCrashAPI.java:349)
1162	at org.h2.test.synth.TestCrashAPI.test(TestCrashAPI.java:176)
1163	at org.h2.test.TestBase.runTest(TestBase.java:141)
1164	at org.h2.test.TestAll.addTest(TestAll.java:988)
1165	at org.h2.test.TestAll.test(TestAll.java:816)
1166	at org.h2.test.TestAll.runTests(TestAll.java:616)
1167	at org.h2.test.TestAll.testAll(TestAll.java:546)
1168	at org.h2.test.TestAll.run(TestAll.java:496)
1169	at org.h2.test.TestAll.main(TestAll.java:438)
1170Caused by: org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0"; SQL statement:
1171SHOW COLUMNS FROM TEST_P [50000-200]
1172	at org.h2.message.DbException.getJdbcSQLException(DbException.java:511)
1173	at org.h2.message.DbException.getJdbcSQLException(DbException.java:435)
1174	at org.h2.message.DbException.get(DbException.java:189)
1175	at org.h2.message.DbException.convert(DbException.java:353)
1176	at org.h2.command.Command.executeQuery(Command.java:210)
1177	at org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:111)
1178	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
1179	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
1180	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
1181	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
1182	at org.h2.test.synth.TestCrashAPI.callRandom(TestCrashAPI.java:395)
1183	... 9 more
1184Caused by: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
1185	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
1186	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
1187	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
1188	at java.base/java.util.Objects.checkIndex(Objects.java:372)
1189	at java.base/java.util.ArrayList.get(ArrayList.java:458)
1190	at org.h2.command.CommandContainer.recompileIfRequired(CommandContainer.java:147)
1191	at org.h2.command.CommandContainer.query(CommandContainer.java:258)
1192	at org.h2.command.Command.executeQuery(Command.java:189)
1193	... 15 more

It looks like number of parameters was changed after recompilation, but why?

Unfortunately, TestCrashAPI can't reproduce own failures. It has some logic with seed numbers, but it is completely broken for a long time.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining CommandContainer.recompileIfRequired() at line 147 and the TestCrashAPI call paths reported in TestCrashAPI.java. Investigate why parameter counts can differ after recompilation, and make the TestCrashAPI seed-based failure reproducible. Done means SHOW COLUMNS FROM TEST_P no longer triggers the IndexOutOfBoundsException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
databases
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.