You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Kristian Waagan (JIRA)" <ji...@apache.org> on 2009/11/10 11:12:28 UTC

[jira] Issue Comment Edited: (DERBY-4102) Assert failure or ClassCastException in EmbedBlob when retrieving BLOB >= 32K

    [ https://issues.apache.org/jira/browse/DERBY-4102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12775362#action_12775362 ] 

Kristian Waagan edited comment on DERBY-4102 at 11/10/09 10:11 AM:
-------------------------------------------------------------------

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.

      was (Author: kristwaa):
    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), and when I was about to investigate where it 

The Java deadlock (see attached dump for details):
  
> Assert failure or ClassCastException in EmbedBlob when retrieving BLOB >= 32K
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-4102
>                 URL: https://issues.apache.org/jira/browse/DERBY-4102
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.1.1.0, 10.2.2.0, 10.3.3.0, 10.4.2.0, 10.5.1.1, 10.6.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Kristian Waagan
>         Attachments: CastExc.java, derby-4102-1a.diff, derby-4102-1a.stat
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.