Derby
  1. Derby
  2. DERBY-4102

Assert failure or ClassCastException in EmbedBlob when retrieving BLOB >= 32K

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.1.1.0, 10.2.2.0, 10.3.3.0, 10.4.2.0, 10.5.1.1, 10.6.1.0
    • Fix Version/s: 10.4.2.1, 10.5.3.1, 10.6.1.0
    • Component/s: JDBC
    • Labels:
      None
    • Urgency:
      Normal

      Description

      The code below results in an assert error (with sane jars) or a ClassCastException (with insane jars):

      PreparedStatement ps = c.prepareStatement("values cast(? as blob)");
      int len = 32 * 1024;
      ps.setBinaryStream(1, new ByteArrayInputStream(new byte[len]), len);
      ResultSet rs = ps.executeQuery();
      while (rs.next())

      { rs.getBlob(1); }

      If len < 32K there is no error.

      1. CastExc.java
        0.6 kB
        Knut Anders Hatlen
      2. derby-4102-1a.diff
        6 kB
        Kristian Waagan
      3. derby-4102-1a.stat
        0.1 kB
        Kristian Waagan
      4. java-deadlock.txt
        12 kB
        Kristian Waagan

        Issue Links

          Activity

          Hide
          Knut Anders Hatlen added a comment -

          Attached is a Java program that reproduces the bug.

          With sane jars:

          Exception in thread "main" java.sql.SQLException: Java exception: 'ASSERT FAILED: org.apache.derby.shared.common.sanity.AssertFailure'.
          at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
          at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
          at org.apache.derby.impl.jdbc.Util.javaException(Util.java:244)
          at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
          at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
          at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2201)
          at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
          at org.apache.derby.impl.jdbc.EmbedResultSet.getBlob(EmbedResultSet.java:4000)
          at CastExc.main(CastExc.java:12)
          Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED: org.apache.derby.shared.common.sanity.AssertFailure'.
          at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
          at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
          at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
          ... 8 more
          Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED
          at org.apache.derby.shared.common.sanity.SanityManager.ASSERT(SanityManager.java:98)
          at org.apache.derby.impl.jdbc.EmbedBlob.<init>(EmbedBlob.java:194)
          at org.apache.derby.impl.jdbc.EmbedResultSet.getBlob(EmbedResultSet.java:3998)
          ... 1 more

          With insane jars:

          Exception in thread "main" java.sql.SQLException: Java exception: 'org.apache.derby.iapi.types.RawToBinaryFormatStream cannot be cast to org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
          at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
          at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
          at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
          at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
          at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
          at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
          at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
          at org.apache.derby.impl.jdbc.EmbedResultSet.getBlob(Unknown Source)
          at CastExc.main(CastExc.java:12)
          Caused by: java.sql.SQLException: Java exception: 'org.apache.derby.iapi.types.RawToBinaryFormatStream cannot be cast to org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
          at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
          at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
          ... 9 more
          Caused by: java.lang.ClassCastException: org.apache.derby.iapi.types.RawToBinaryFormatStream cannot be cast to org.apache.derby.iapi.types.Resetable
          at org.apache.derby.impl.jdbc.PositionedStoreStream.<init>(Unknown Source)
          at org.apache.derby.impl.jdbc.EmbedBlob.<init>(Unknown Source)
          ... 2 more

          Show
          Knut Anders Hatlen added a comment - Attached is a Java program that reproduces the bug. With sane jars: Exception in thread "main" java.sql.SQLException: Java exception: 'ASSERT FAILED: org.apache.derby.shared.common.sanity.AssertFailure'. at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87) at org.apache.derby.impl.jdbc.Util.javaException(Util.java:244) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403) at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346) at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2201) at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81) at org.apache.derby.impl.jdbc.EmbedResultSet.getBlob(EmbedResultSet.java:4000) at CastExc.main(CastExc.java:12) Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED: org.apache.derby.shared.common.sanity.AssertFailure'. at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45) at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119) at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70) ... 8 more Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED at org.apache.derby.shared.common.sanity.SanityManager.ASSERT(SanityManager.java:98) at org.apache.derby.impl.jdbc.EmbedBlob.<init>(EmbedBlob.java:194) at org.apache.derby.impl.jdbc.EmbedResultSet.getBlob(EmbedResultSet.java:3998) ... 1 more With insane jars: Exception in thread "main" java.sql.SQLException: Java exception: 'org.apache.derby.iapi.types.RawToBinaryFormatStream cannot be cast to org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'. at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source) at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedResultSet.getBlob(Unknown Source) at CastExc.main(CastExc.java:12) Caused by: java.sql.SQLException: Java exception: 'org.apache.derby.iapi.types.RawToBinaryFormatStream cannot be cast to org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'. at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source) ... 9 more Caused by: java.lang.ClassCastException: org.apache.derby.iapi.types.RawToBinaryFormatStream cannot be cast to org.apache.derby.iapi.types.Resetable at org.apache.derby.impl.jdbc.PositionedStoreStream.<init>(Unknown Source) at org.apache.derby.impl.jdbc.EmbedBlob.<init>(Unknown Source) ... 2 more
          Hide
          Kristian Waagan added a comment -

          Patch 1a is a prototype patch which passes the repro posted by Knut Anders. I have started the regression tests, and will post the results tomorrow.

          The patch makes Derby store the stream as a temporary Blob (in the database's tmp directory). This is the same thing as is being done for small Blobs already.
          Depending on the length of the stream, the temporary Blob will be held in memory or on disk.

          I also had a look at the Clob implementation, and it turns out that it already works. However, that code path uses a different approach - it materializes the Clob into memory (see SQLChar.setFrom). I'll file a separate issue for this problem.

          Show
          Kristian Waagan added a comment - Patch 1a is a prototype patch which passes the repro posted by Knut Anders. I have started the regression tests, and will post the results tomorrow. The patch makes Derby store the stream as a temporary Blob (in the database's tmp directory). This is the same thing as is being done for small Blobs already. Depending on the length of the stream, the temporary Blob will be held in memory or on disk. I also had a look at the Clob implementation, and it turns out that it already works. However, that code path uses a different approach - it materializes the Clob into memory (see SQLChar.setFrom). I'll file a separate issue for this problem.
          Hide
          Knut Anders Hatlen added a comment -

          The patch looks good to me. I've verified that the repro passes with the fix, and that the test case fails without the fix and passes with the fix.

          Show
          Knut Anders Hatlen added a comment - The patch looks good to me. I've verified that the repro passes with the fix, and that the test case fails without the fix and passes with the fix.
          Hide
          Kristian Waagan added a comment -

          Running the regression tests. If they all pass, I'll commit patch 1a tomorrow.

          Show
          Kristian Waagan added a comment - Running the regression tests. If they all pass, I'll commit patch 1a tomorrow.
          Hide
          Kristian Waagan added a comment -

          I'm seeing an intermittent failure when running with the patch. The failure happens in jdbcapi.LobStreamsTest.
          I have seen the following two stack traces:

          1) testBlobWrite3Param(org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest)java.io.IOException: ERROR 40XD0: Container has been closed.
          at org.apache.derby.impl.store.raw.data.OverflowInputStream.fillByteHolder(OverflowInputStream.java:159)
          at org.apache.derby.impl.store.raw.data.BufferedByteHolderInputStream.read(BufferedByteHolderInputStream.java:44)
          at java.io.DataInputStream.read(DataInputStream.java:132)
          at org.apache.derby.impl.jdbc.PositionedStoreStream.read(PositionedStoreStream.java:116)
          at org.apache.derby.impl.jdbc.AutoPositioningStream.read(AutoPositioningStream.java:113)
          at org.apache.derby.impl.jdbc.UpdatableBlobStream.read(UpdatableBlobStream.java:184)
          at org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest.readBytesFromStream(LobStreamsTest.java:463)
          at org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest.compareLob2File(LobStreamsTest.java:488)
          at org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest.testBlobWrite3Param(LobStreamsTest.java:130)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:105)
          at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
          at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
          at junit.extensions.TestSetup.run(TestSetup.java:25)
          at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
          at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
          at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
          at junit.extensions.TestSetup.run(TestSetup.java:25)
          at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
          at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
          at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
          at junit.extensions.TestSetup.run(TestSetup.java:25)

          FAILURES!!!
          Tests run: 24, Failures: 0, Errors: 1

          1) testBlobWrite3Param(org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest)java.sql.SQLException: The data in this BLOB or CLOB is no longer available. The BLOB/CLOB's transaction may be committed, its connection closed or it has been freed.
          at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
          at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:201)
          at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:391)
          at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
          at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2201)
          at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
          at org.apache.derby.impl.jdbc.EmbedBlob.handleMyExceptions(EmbedBlob.java:792)
          at org.apache.derby.impl.jdbc.EmbedBlob.getBinaryStream(EmbedBlob.java:549)
          at org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest.testBlobWrite3Param(LobStreamsTest.java:129)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:105)
          at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
          at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
          at junit.extensions.TestSetup.run(TestSetup.java:25)
          at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
          Caused by: java.sql.SQLException: The data in this BLOB or CLOB is no longer available. The BLOB/CLOB's transaction may be committed, its connection closed or it has been freed.
          at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
          at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
          at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
          ... 39 more
          Caused by: ERROR XJ073: The data in this BLOB or CLOB is no longer available. The BLOB/CLOB's transaction may be committed, its connection closed or it has been freed.
          at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:276)
          at org.apache.derby.impl.jdbc.EmbedBlob.handleMyExceptions(EmbedBlob.java:789)
          ... 33 more

          On my system the problem is seen in maybe one out of ten or fifteen runs. I can't see the new code being run as part of the test, so I'm not sure what's going on here.

          Show
          Kristian Waagan added a comment - I'm seeing an intermittent failure when running with the patch. The failure happens in jdbcapi.LobStreamsTest. I have seen the following two stack traces: 1) testBlobWrite3Param(org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest)java.io.IOException: ERROR 40XD0: Container has been closed. at org.apache.derby.impl.store.raw.data.OverflowInputStream.fillByteHolder(OverflowInputStream.java:159) at org.apache.derby.impl.store.raw.data.BufferedByteHolderInputStream.read(BufferedByteHolderInputStream.java:44) at java.io.DataInputStream.read(DataInputStream.java:132) at org.apache.derby.impl.jdbc.PositionedStoreStream.read(PositionedStoreStream.java:116) at org.apache.derby.impl.jdbc.AutoPositioningStream.read(AutoPositioningStream.java:113) at org.apache.derby.impl.jdbc.UpdatableBlobStream.read(UpdatableBlobStream.java:184) at org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest.readBytesFromStream(LobStreamsTest.java:463) at org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest.compareLob2File(LobStreamsTest.java:488) at org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest.testBlobWrite3Param(LobStreamsTest.java:130) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:105) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24) at junit.extensions.TestSetup$1.protect(TestSetup.java:21) at junit.extensions.TestSetup.run(TestSetup.java:25) at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24) at junit.extensions.TestSetup$1.protect(TestSetup.java:21) at junit.extensions.TestSetup.run(TestSetup.java:25) at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24) at junit.extensions.TestSetup$1.protect(TestSetup.java:21) at junit.extensions.TestSetup.run(TestSetup.java:25) FAILURES!!! Tests run: 24, Failures: 0, Errors: 1 1) testBlobWrite3Param(org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest)java.sql.SQLException: The data in this BLOB or CLOB is no longer available. The BLOB/CLOB's transaction may be committed, its connection closed or it has been freed. at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95) at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:201) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:391) at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346) at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2201) at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81) at org.apache.derby.impl.jdbc.EmbedBlob.handleMyExceptions(EmbedBlob.java:792) at org.apache.derby.impl.jdbc.EmbedBlob.getBinaryStream(EmbedBlob.java:549) at org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest.testBlobWrite3Param(LobStreamsTest.java:129) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:105) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24) at junit.extensions.TestSetup$1.protect(TestSetup.java:21) at junit.extensions.TestSetup.run(TestSetup.java:25) at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57) Caused by: java.sql.SQLException: The data in this BLOB or CLOB is no longer available. The BLOB/CLOB's transaction may be committed, its connection closed or it has been freed. at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45) at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119) at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70) ... 39 more Caused by: ERROR XJ073: The data in this BLOB or CLOB is no longer available. The BLOB/CLOB's transaction may be committed, its connection closed or it has been freed. at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:276) at org.apache.derby.impl.jdbc.EmbedBlob.handleMyExceptions(EmbedBlob.java:789) ... 33 more On my system the problem is seen in maybe one out of ten or fifteen runs. I can't see the new code being run as part of the test, so I'm not sure what's going on here.
          Hide
          Rick Hillegas added a comment -

          Triaged July 2, 2009: Assigned normal urgency.

          Show
          Rick Hillegas added a comment - Triaged July 2, 2009: Assigned normal urgency.
          Hide
          Kristian Waagan added a comment - - edited

          Testing this patch again, I have observed an intermittent failure both with a clean trunk and with a patched trunk (patch DERBY-4102 1a).

          Running with a sane build:
          1) testBlobWrite3Param(org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest)org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED
          at org.apache.derby.shared.common.sanity.SanityManager.ASSERT(SanityManager.java:98)
          at org.apache.derby.impl.store.raw.data.BasePage.unlatch(BasePage.java:1365)
          at org.apache.derby.impl.store.raw.data.OverflowInputStream.fillByteHolder(OverflowInputStream.java:152)
          at org.apache.derby.impl.store.raw.data.BufferedByteHolderInputStream.read(BufferedByteHolderInputStream.java:44)
          at java.io.DataInputStream.read(DataInputStream.java:132)
          at org.apache.derby.impl.jdbc.PositionedStoreStream.read(PositionedStoreStream.java:116)
          at org.apache.derby.impl.jdbc.AutoPositioningStream.read(AutoPositioningStream.java:113)
          at org.apache.derby.impl.jdbc.UpdatableBlobStream.read(UpdatableBlobStream.java:184)
          at org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest.readBytesFromStream(LobStreamsTest.java:463)
          at org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest.compareLob2File(LobStreamsTest.java:488)
          at org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest.testBlobWrite3Param(LobStreamsTest.java:130)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:109)
          at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
          at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
          at junit.extensions.TestSetup.run(TestSetup.java:25)
          at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)

          This associated code in BasePage is:
          public void unlatch() {
          if (SanityManager.DEBUG)

          { SanityManager.ASSERT(isLatched()); }

          releaseExclusive();
          }

          1) testBlobWrite3Param(org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest)java.io.IOException: ERROR 40XD0: Container has been closed.
          at org.apache.derby.impl.store.raw.data.OverflowInputStream.fillByteHolder(OverflowInputStream.java:159)
          at org.apache.derby.impl.store.raw.data.BufferedByteHolderInputStream.read(BufferedByteHolderInputStream.java:44)
          at java.io.DataInputStream.read(DataInputStream.java:132)
          at org.apache.derby.impl.jdbc.PositionedStoreStream.read(PositionedStoreStream.java:116)
          at org.apache.derby.impl.jdbc.AutoPositioningStream.read(AutoPositioningStream.java:113)
          at org.apache.derby.impl.jdbc.UpdatableBlobStream.read(UpdatableBlobStream.java:184)
          at org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest.readBytesFromStream(LobStreamsTest.java:463)
          at org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest.compareLob2File(LobStreamsTest.java:488)
          at org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest.testBlobWrite3Param(LobStreamsTest.java:130)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:109)
          at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
          at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
          at junit.extensions.TestSetup.run(TestSetup.java:25)
          at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)

          The origin of the real exception is lost here (not chained), but investigation shows where it comes from:
          at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:276)
          at org.apache.derby.impl.store.raw.data.BaseContainerHandle.checkOpen(BaseContainerHandle.java:978)
          at org.apache.derby.impl.store.raw.data.BaseContainerHandle.getPage(BaseContainerHandle.java:317)
          at org.apache.derby.impl.store.raw.data.OverflowInputStream.fillByteHolder(OverflowInputStream.java:146)
          at org.apache.derby.impl.store.raw.data.BufferedByteHolderInputStream.read(BufferedByteHolderInputStream.java:44)
          ...

          The Java deadlock (see attached dump for details):
          Found one Java-level deadlock:
          =============================
          "Finalizer":
          waiting to lock monitor 0x080f2038 (object 0xceb8ef08, a org.apache.derby.impl.store.raw.data.StoredPage),
          which is held by "main"
          "main":
          waiting to lock monitor 0x082b5ef8 (object 0xceb98fe8, a org.apache.derby.impl.store.raw.data.BaseContainerHandle),
          which is held by "Finalizer"

          Since the problem occurs both with and without the patch, I plan to commit it.
          I will log a new Jira for the deadlock and the asserts/exceptions. I assume they are all symptoms of the same problem, arising due to slightly different timing.

          Show
          Kristian Waagan added a comment - - edited Testing this patch again, I have observed an intermittent failure both with a clean trunk and with a patched trunk (patch DERBY-4102 1a). Running with a sane build: 1) testBlobWrite3Param(org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest)org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED at org.apache.derby.shared.common.sanity.SanityManager.ASSERT(SanityManager.java:98) at org.apache.derby.impl.store.raw.data.BasePage.unlatch(BasePage.java:1365) at org.apache.derby.impl.store.raw.data.OverflowInputStream.fillByteHolder(OverflowInputStream.java:152) at org.apache.derby.impl.store.raw.data.BufferedByteHolderInputStream.read(BufferedByteHolderInputStream.java:44) at java.io.DataInputStream.read(DataInputStream.java:132) at org.apache.derby.impl.jdbc.PositionedStoreStream.read(PositionedStoreStream.java:116) at org.apache.derby.impl.jdbc.AutoPositioningStream.read(AutoPositioningStream.java:113) at org.apache.derby.impl.jdbc.UpdatableBlobStream.read(UpdatableBlobStream.java:184) at org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest.readBytesFromStream(LobStreamsTest.java:463) at org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest.compareLob2File(LobStreamsTest.java:488) at org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest.testBlobWrite3Param(LobStreamsTest.java:130) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:109) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24) at junit.extensions.TestSetup$1.protect(TestSetup.java:21) at junit.extensions.TestSetup.run(TestSetup.java:25) at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57) This associated code in BasePage is: public void unlatch() { if (SanityManager.DEBUG) { SanityManager.ASSERT(isLatched()); } releaseExclusive(); } 1) testBlobWrite3Param(org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest)java.io.IOException: ERROR 40XD0: Container has been closed. at org.apache.derby.impl.store.raw.data.OverflowInputStream.fillByteHolder(OverflowInputStream.java:159) at org.apache.derby.impl.store.raw.data.BufferedByteHolderInputStream.read(BufferedByteHolderInputStream.java:44) at java.io.DataInputStream.read(DataInputStream.java:132) at org.apache.derby.impl.jdbc.PositionedStoreStream.read(PositionedStoreStream.java:116) at org.apache.derby.impl.jdbc.AutoPositioningStream.read(AutoPositioningStream.java:113) at org.apache.derby.impl.jdbc.UpdatableBlobStream.read(UpdatableBlobStream.java:184) at org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest.readBytesFromStream(LobStreamsTest.java:463) at org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest.compareLob2File(LobStreamsTest.java:488) at org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest.testBlobWrite3Param(LobStreamsTest.java:130) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:109) at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24) at junit.extensions.TestSetup$1.protect(TestSetup.java:21) at junit.extensions.TestSetup.run(TestSetup.java:25) at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57) The origin of the real exception is lost here (not chained), but investigation shows where it comes from: at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:276) at org.apache.derby.impl.store.raw.data.BaseContainerHandle.checkOpen(BaseContainerHandle.java:978) at org.apache.derby.impl.store.raw.data.BaseContainerHandle.getPage(BaseContainerHandle.java:317) at org.apache.derby.impl.store.raw.data.OverflowInputStream.fillByteHolder(OverflowInputStream.java:146) at org.apache.derby.impl.store.raw.data.BufferedByteHolderInputStream.read(BufferedByteHolderInputStream.java:44) ... The Java deadlock (see attached dump for details): Found one Java-level deadlock: ============================= "Finalizer": waiting to lock monitor 0x080f2038 (object 0xceb8ef08, a org.apache.derby.impl.store.raw.data.StoredPage), which is held by "main" "main": waiting to lock monitor 0x082b5ef8 (object 0xceb98fe8, a org.apache.derby.impl.store.raw.data.BaseContainerHandle), which is held by "Finalizer" Since the problem occurs both with and without the patch, I plan to commit it. I will log a new Jira for the deadlock and the asserts/exceptions. I assume they are all symptoms of the same problem, arising due to slightly different timing.
          Hide
          Kristian Waagan added a comment -

          The Java deadlock seen when running tests.jdbcapi.LobStreamsTest (dual core machine, 3.2 GHz).

          Show
          Kristian Waagan added a comment - The Java deadlock seen when running tests.jdbcapi.LobStreamsTest (dual core machine, 3.2 GHz).
          Hide
          Knut Anders Hatlen added a comment -

          The intermittent failure in testBlobWrite3Param() is already logged as DERBY-3844.

          Show
          Knut Anders Hatlen added a comment - The intermittent failure in testBlobWrite3Param() is already logged as DERBY-3844 .
          Hide
          Kristian Waagan added a comment -

          Thanks, Knut Anders.
          I added a link to that issue. I'm considering to log a new Jira for the deadlock, linking it to the other issue.
          FYI, I can reproduce the assert by running LobStreamsTest in a loop. I see it 2 - 4 times out of 100 iterations on my machine. The deadlock I have only seen once so far.

          Show
          Kristian Waagan added a comment - Thanks, Knut Anders. I added a link to that issue. I'm considering to log a new Jira for the deadlock, linking it to the other issue. FYI, I can reproduce the assert by running LobStreamsTest in a loop. I see it 2 - 4 times out of 100 iterations on my machine. The deadlock I have only seen once so far.
          Hide
          Kristian Waagan added a comment -

          Committed patch 1a to trunk with revision 835286. Will check if the fix can be back-ported.

          Show
          Kristian Waagan added a comment - Committed patch 1a to trunk with revision 835286. Will check if the fix can be back-ported.
          Hide
          Kristian Waagan added a comment -

          The regression tests ran cleanly on both the 10.5 and 10.4 branch.
          Merged fix into the 10.5 and 10.4 branches with revisions 903222 and 903223.

          This should complete the work on this issue.

          Show
          Kristian Waagan added a comment - The regression tests ran cleanly on both the 10.5 and 10.4 branch. Merged fix into the 10.5 and 10.4 branches with revisions 903222 and 903223. This should complete the work on this issue.
          Hide
          Knut Anders Hatlen added a comment -

          Verified fix on trunk. Closing.

          Show
          Knut Anders Hatlen added a comment - Verified fix on trunk. Closing.

            People

            • Assignee:
              Kristian Waagan
              Reporter:
              Knut Anders Hatlen
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development