[
https://issues.apache.org/jira/browse/DERBY-3732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12608879#action_12608879
]
Kathey Marsden commented on DERBY-3732:
---------------------------------------
I tried switching over to reflection and running with IBM and Sun JDK 1.4.2
and get an OOM in client running with 16MB heap. JDK 1.5 runs fine. Embedded
is also ok with JDK 1.4.2. I'm investigating but if anyone knows of maybe some
different behavior in client for JDK 1.4.2 that might cause this, let me know.
1)
testBlobLength(org.apache.derbyTesting.functionTests.tests.memory.BlobMemTest)java.lang.OutOfMemoryError:
at
org.apache.derby.client.am.Cursor.get_VARCHAR_FOR_BIT_DATA(Cursor.java:647)
at org.apache.derby.client.am.Cursor.getBytes(Cursor.java:1058)
at
org.apache.derby.client.am.CallableStatement.getBytesX(CallableStatement.java:676)
at
org.apache.derby.client.am.CallableLocatorProcedures.blobGetBytes(CallableLocatorProcedures.java:447)
at
org.apache.derby.client.am.BlobLocatorInputStream.readBytes(BlobLocatorInputStream.java:176)
at
org.apache.derby.client.am.BlobLocatorInputStream.read(BlobLocatorInputStream.java:135)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:237)
at java.io.BufferedInputStream.read(BufferedInputStream.java:294)
at java.io.FilterInputStream.read(FilterInputStream.java(Compiled Code))
at
org.apache.derby.client.am.CloseFilterInputStream.read(CloseFilterInputStream.java:79)
at java.io.FilterInputStream.read(FilterInputStream.java:110)
at
org.apache.derby.client.am.CloseFilterInputStream.read(CloseFilterInputStream.java:65)
at
org.apache.derbyTesting.functionTests.tests.memory.BlobMemTest.testBlobLength(BlobMemTest.java:124)
at
org.apache.derbyTesting.functionTests.tests.memory.BlobMemTest.testBlobLength(BlobMemTest.java:170)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled
Code))
at
org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:104)
at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
at junit.extensions.TestSetup.run(TestSetup.java:23)
at
org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
at junit.extensions.TestSetup.run(TestSetup.java:23)
at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
at junit.extensions.TestSetup.run(TestSetup.java:23)
at
org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
at junit.extensions.TestSetup.run(TestSetup.java:23)
> SQL Length function materializes lob into memory
> ------------------------------------------------
>
> Key: DERBY-3732
> URL: https://issues.apache.org/jira/browse/DERBY-3732
> Project: Derby
> Issue Type: Improvement
> Components: SQL
> Affects Versions: 10.3.3.0, 10.4.1.3, 10.5.0.0
> Reporter: Kathey Marsden
> Priority: Minor
> Attachments: derby-3732_diff.txt, derby-3732_proto_diff.txt,
> derby-3732_skip2_diff.txt, derby-3732_skip_diff.txt, LengthLargeLob.zip,
> LengthThruBlob.java
>
>
> Currently the SQL length function materializes the entire lob into memory. In
> SQLBinary.getLength() we have
> public final int getLength() throws StandardException
> {
> if (stream != null) {
> if (streamValueLength != -1)
> return streamValueLength;
> }
> return (getBytes() == null) ? 0 : getBytes().length;
> }
> Which actually is doubly bad because we call getBytes twice and materialize
> it twice.
> It would be good to read the length from the stream if available and
> otherwise stream the value to get the length, rather than materializing it
> into memory.
> To reproduce, run the attached repro.
> java -Xmx16M LengthLargeLob
> It gives an out of memory exception
> Caused by: java.lang.OutOfMemoryError: Java heap space
> at
> org.apache.derby.iapi.types.SQLBinary.readFromStream(SQLBinary.java:415)
> at
> org.apache.derby.iapi.types.SQLBinary.readExternal(SQLBinary.java:318)
> at org.apache.derby.iapi.types.SQLBinary.getValue(SQLBinary.java:220)
> at org.apache.derby.iapi.types.SQLBinary.getBytes(SQLBinary.java:210)
> at org.apache.derby.iapi.types.SQLBinary.getLength(SQLBinary.java:250)
> at
> org.apache.derby.impl.sql.execute.BaseActivation.getDB2Length(BaseActivation.java:1684)
> at
> org.apache.derby.exe.acf81e0010x011axa317x5db8x0000003d9dc81.e1(Unknown
> Source)
> at
> org.apache.derby.impl.services.reflect.DirectCall.invoke(ReflectGeneratedClass.java:141)
> at
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.doProjection(ProjectRestrictResultSet.java:497)
> at
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCore(ProjectRestrictResultSet.java:291)
> at
> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(BasicNoPutResultSetImpl.java:460)
> at
> org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:423)
> ... 2 more
> [
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.