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

Exception in getMaxRows() after NullPointerException in SQLClob.readExternal() during query in table with CLOB column

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 10.5.1.1
    • Fix Version/s: 10.5.2.0, 10.6.1.0
    • Component/s: SQL
    • Labels:
      None
    • Issue & fix info:
      High Value Fix, Repro attached
    • Bug behavior facts:
      Regression

      Description

      Observed derby 10.5.1.1 throwing exception in getMaxRows() when querying table with greater than ~20K rows and CLOB column.

      The exception is :

      java.sql.SQLException: No current connection.
      at org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown Source)
      at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
      at org.apache.derby.client.am.Statement.getMaxRows(Unknown Source)
      at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.getMaxRows(NewProxyPreparedStatement.java:1200)
      at org.hibernate.jdbc.AbstractBatcher.closeQueryStatement(AbstractBatcher.java:298)
      at org.hibernate.jdbc.AbstractBatcher.closeQueryStatement(AbstractBatcher.java:234)
      at org.hibernate.loader.Loader.getResultSet(Loader.java:1826)
      at org.hibernate.loader.Loader.doQuery(Loader.java:697)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
      at org.hibernate.loader.Loader.doList(Loader.java:2232)
      at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129)
      at org.hibernate.loader.Loader.list(Loader.java:2124)
      at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:118)
      at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1597)
      at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306)
      at com.jw.TestMain.query(TestMain.java:175)
      at com.jw.TestMain.main(TestMain.java:189)
      Caused by: org.apache.derby.client.am.SqlException: No current connection.
      at org.apache.derby.client.am.Statement.checkForClosedStatement(Unknown Source)

      In digging into the stacktrace a little more it seems that hibernates call to getMaxRows() blows up because checkForClosedStatement() throws the SQLException, but I have no idea why. (I've verified the connection is open prior to executing hibenates list(), and it happens too quickly to be a true timeout.)

      It only happens once my table reaches any significant size ( > 20K rows), and only on this particular table which includes a CLOB column.

      Curiously 10.4.2.1 does not exhibit this behavior.

      I have prepared a small eclipse project which repros the error and will attach.

        Attachments

        1. derby_10.5_debug.zip
          7.80 MB
          Jason Ward
        2. derby.log
          3 kB
          Jason Ward

          Issue Links

            Activity

              People

              • Assignee:
                kristwaa Kristian Waagan
                Reporter:
                jmward Jason Ward
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: