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

Calling Blob/Clob free() explicitly after implicit free throws exception in client driver

    XMLWordPrintableJSON

Details

    • Normal
    • High Value Fix, Newcomer, Repro attached, Workaround attached
    • Embedded/Client difference

    Description

      If a Blob or Clob is freed implicitly in the client driver, calling free explicitly afterwards will throw an exception. Instead, this should probably be a no-op.

      To reproduce, do something like this:
      con.setAutoCommit(false);
      Clob c = con.createClob();
      con.commit();
      c.free();

      ==>
      Caused by: org.apache.derby.client.am.SqlException: You cannot invoke other java.sql.Clob/java.sql.Blob methods after calling the free() method or after the Blob/Clob's transaction has been committed or rolled back.
      at org.apache.derby.client.am.CallableLocatorProcedures.handleInvalidLocator(CallableLocatorProcedures.java:1071)
      at org.apache.derby.client.am.CallableLocatorProcedures.clobReleaseLocator(CallableLocatorProcedures.java:664)
      at org.apache.derby.client.am.Clob.free(Clob.java:844)
      ... 38 more
      Caused by: org.apache.derby.client.am.SqlException: The exception 'java.sql.SQLException: The locator that was supplied for this CLOB/BLOB is invalid' was thrown while evaluating an expression.
      at org.apache.derby.client.am.Statement.completeExecute(Statement.java:1604)
      at org.apache.derby.client.net.NetStatementReply.parseEXCSQLSTTreply(NetStatementReply.java:322)
      at org.apache.derby.client.net.NetStatementReply.readExecuteCall(NetStatementReply.java:106)
      at org.apache.derby.client.net.StatementReply.readExecuteCall(StatementReply.java:75)
      at org.apache.derby.client.net.NetStatement.readExecuteCall_(NetStatement.java:175)
      at org.apache.derby.client.am.Statement.readExecuteCall(Statement.java:1570)
      at org.apache.derby.client.am.PreparedStatement.flowExecute(PreparedStatement.java:2156)
      at org.apache.derby.client.am.PreparedStatement.executeX(PreparedStatement.java:1599)
      at org.apache.derby.client.am.CallableLocatorProcedures.clobReleaseLocator(CallableLocatorProcedures.java:662)
      ... 39 more
      Caused by: org.apache.derby.client.am.SqlException: The locator that was supplied for this CLOB/BLOB is invalid
      ... 48 more

      The problem dosen't exist in the embedded driver.
      The immediate cause seems to be that the client driver state becomes out of sync with the server side. This may be fixable by dealing specifically witht the invalid locator exception in free().

      Attachments

        1. derby-5605_diff.txt
          3 kB
          Katherine Marsden
        2. derby-5605_diff.txt
          2 kB
          Katherine Marsden

        Activity

          People

            kmarsden Katherine Marsden
            kristwaa Kristian Waagan
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: