SQL PreparedStatement Will Cause Any Subsequent PreparedStatement to Hang Until Previous PreparedStatement is Finished (Doc ID 1622515.1)

Last updated on NOVEMBER 05, 2016

Applies to:

Oracle WebLogic Server - Version 10.3.5 and later
Information in this document applies to any platform.

Symptoms

A prepared statement containing several database queries runs for some amount of time. Once one of the queries in the prepared statement returns the expected result set, it closes the connection, as expected on the code. However, the prepared statement contains other queries which eventually can take more time to finish. If we trigger a second prepared statement while the first one is still running, then thread dumps will show a hogging thread on the following piece of code:

The DB reports that prepared statement 1 has completed when it has not, and then begins to execute prepared statement 2. However, prepared statement 2 cannot complete until after prepared statement 1 has completed, so it only completes after the simulated long-running query in prepared statement 1 has completed. The logical order of execution would be:

  1. Prepared statement 1 is executed
  2. Prepared statement 1 finishes
  3. Prepared statement 2 is executed
  4. Prepared statement 2 finishes

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms