Troubleshooting
Problem
When multiple processing threads access a Java™ database connectivity (JDBC) resource adapter object in IBM WebSphere Application Server, the Application Server might create an IndexOutOfBoundsException exception or other exceptions.
Symptom
There are many possible symptoms that might occur. However, if you examine the Java exception stacks in the logs for the Application Server, you will see an exception that is similar to the following excerpt:
The stack output might reveal that this code was invoked from a Java finalize thread. This thread is closing JDBC objects or the code is closing higher-level objects that contain references to open JDBC objects.
Caused by: java.lang.IndexOutOfBoundsException:
Index: 0, Size:
at java.util.ArrayList.RangeCheck(ArrayList.java:572)
at java.util.ArrayList.get(ArrayList.java:347)
at com.ibm.ws.rsadapter.jdbc.
WSJdbcObject.closeChildWrappers(WSJdbcObject.java:216)
at com.ibm.ws.rsadapter.jdbc.
WSJdbcObject.close(WSJdbcObject.java:179)
...
The stack output might reveal that this code was invoked from a Java finalize thread. This thread is closing JDBC objects or the code is closing higher-level objects that contain references to open JDBC objects.
Cause
The JDBC resource adapter code for the Application Server requires that an application, or other middleware that is acting on behalf of an application, only access an instance of the JDBC objects for the Application Server from a single thread at a time. Examples of these JDBC objects are the WSJdbcConnection, WSJdbcStatement, WSJdbcResultSet objects.
Multiple threads can operate simultaneously on different JDBC objects that are allocated to those threads. However, a thread cannot use a JDBC object if the object is already allocated to another thread. If you are using the WebSphere Relational Resource Adapter, ensure that any JDBC objects that are opened or created by an execution thread are closed by that same thread.
The following scenario is not allowed:
The JDBC objects are not closed by the thread that is using the object. A reference to that JDBC object is stored in a different user object that is closed by a finalize method during garbage collection.
This scenario might seem to work correctly during times of low or moderate workload. However, during heavy workload, it is more likely that a collision will occur between activity on a thread that is calling the finalize method and activity on a functional thread. An exception or other thread-safety problem is likely to occur.
Multiple threads can operate simultaneously on different JDBC objects that are allocated to those threads. However, a thread cannot use a JDBC object if the object is already allocated to another thread. If you are using the WebSphere Relational Resource Adapter, ensure that any JDBC objects that are opened or created by an execution thread are closed by that same thread.
The following scenario is not allowed:
The JDBC objects are not closed by the thread that is using the object. A reference to that JDBC object is stored in a different user object that is closed by a finalize method during garbage collection.
This scenario might seem to work correctly during times of low or moderate workload. However, during heavy workload, it is more likely that a collision will occur between activity on a thread that is calling the finalize method and activity on a functional thread. An exception or other thread-safety problem is likely to occur.
Diagnosing The Problem
Examine all of the exception stacks in the SystemOut log or tracing log file that might be related to the error. If a finalize method, which is called from a Java garbage collection thread, is involved, then the scenario is similar to the previously described scenario.
If you are not able to determine the source of the multi-threaded access with this method, set the enableMultithreadedAccessDetection custom property to true in the affected data source, to do it all you need to do is enable option Enable multithreaded access detection:
If you are not able to determine the source of the multi-threaded access with this method, set the enableMultithreadedAccessDetection custom property to true in the affected data source, to do it all you need to do is enable option Enable multithreaded access detection:
Attempt to recreate the problem.
When the enableMultithreadedAccessDetection custom property is set to true, the WebSphere Relational Resource Adapter will log the DSRA8720W message if it detects multi-threaded access to JDBC objects. Set the property back to false when the diagnosis is complete to eliminate any performance impacts. The enableMultithreadedAccessDetection custom property is a method to help you diagnose the problem, but this method does not detect all of the cases where objects are being accessed by multiple threads. In addition to setting this custom property, verify that your programming model is designed properly.
When the enableMultithreadedAccessDetection custom property is set to true, the WebSphere Relational Resource Adapter will log the DSRA8720W message if it detects multi-threaded access to JDBC objects. Set the property back to false when the diagnosis is complete to eliminate any performance impacts. The enableMultithreadedAccessDetection custom property is a method to help you diagnose the problem, but this method does not detect all of the cases where objects are being accessed by multiple threads. In addition to setting this custom property, verify that your programming model is designed properly.
Resolving The Problem
Redesign your applications to access JDBC objects with single threads. If your applications are using other frameworks or componentry that is accessing the JDBC objects with multiple threads, refer to the support site for the componentry vendor for more information.
If the code violation is the result of a finalize method on an object that contains references to JDBC objects in the Application Server, modify the finalize method to not call the close method on those JDBC objects. Use the functional path code to close those JDBC objects.
If the code violation is the result of a finalize method on an object that contains references to JDBC objects in the Application Server, modify the finalize method to not call the close method on those JDBC objects. Use the functional path code to close those JDBC objects.
[{"Type":"MASTER","Line of Business":{"code":"LOB45","label":"Automation"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"ARM Category":[{"code":"a8m50000000CdYAAA0","label":"J2C-ConnectionPooling-JDBCDrivers->Connection Pooling-J2C-DB Connections->Connection Pooling"}],"ARM Case Number":"","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"8.5.5;9.0.0;9.0.5"},{"Type":"MASTER","Line of Business":{"code":"LOB45","label":"Automation"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SS7K4U","label":"WebSphere Application Server for z\/OS"},"ARM Category":[{"code":"a8m50000000CdYAAA0","label":"J2C-ConnectionPooling-JDBCDrivers->Connection Pooling-J2C-DB Connections->Connection Pooling"}],"Platform":[{"code":"PF035","label":"z\/OS"}],"Version":"8.5.5;9.0.0;9.0.5"}]
Was this topic helpful?
Document Information
Modified date:
24 September 2021
UID
swg21284252