Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-4018

ArrayIndexOutOfBoundsException in TopService.inService under heavy multithreaded use of EmbeddedDriver



    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s:
    • Fix Version/s:,
    • Component/s: Services
    • Labels:
    • Environment:
      Windows XP SP2
      Intel Core 2 Duo 3GHz, 3GB RAM
      Java JDK 1.6.0_07
    • Issue & fix info:
      High Value Fix


      I have created a test program that reproduces this issue. The program pounds on Derby by running jobs on a pool of 10 threads. Each job creates a new Derby database, a schema, a table, and an index. Then it shuts down the database and finishes. The program runs until an error occurs or until 1000 jobs have finished.

      The problem is very intermittent, and related I think to multithreaded access of a vector "moduleInstances" in TopService.java. I am seeing the error on my machine about half the time I run the test program. Sometimes it happens after 100 or 200 jobs...but sometimes not until 500 or more, or not at all.

      I am using the 10.4.2 derby.jar downloaded from http://db.apache.org/derby/releases/release-, without any modifications on my part.

      I will attach the test program plus output from a run that failed with the ArrayIndexOutOfBoundsException. (The actual exception thrown to the application from Derby is SQLException, but the underlying cause is an ArrayIndexOutOfBoundsException.) BE AWARE that if you run this test program it can use up a GByte or more of disk space in your Java tmp directory.


        1. BeatDerbyToPieces.java
          6 kB
          Jeff Clary
        2. d4018-1a.diff
          2 kB
          Knut Anders Hatlen
        3. d4018-2a.diff
          2 kB
          Knut Anders Hatlen
        4. program_output.txt
          141 kB
          Jeff Clary
        5. sync.diff
          5 kB
          Knut Anders Hatlen
        6. trunk_stacktrace.txt
          7 kB
          Kristian Waagan



            • Assignee:
              knutanders Knut Anders Hatlen
              clary2137 Jeff Clary
            • Votes:
              1 Vote for this issue
              1 Start watching this issue


              • Created: