You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Øyvind Harboe <oy...@zylin.com> on 2008/09/12 09:50:44 UTC

Stack overflow with Derby adapter

I've got an obscure bug in our app that is caused by a stack
overflow with Derby.

The problem is that 'OR' is implemented recursively inside Derby, so
when using ExpressionFactoyr.inExp() w/a *long* list, the stack overflows.


Can this be worked around in the Cayenne Derby adapter?

Should it?

Ideally I'd like to see it worked around in the Cayenne Derby adapter and
fixed in Derby I guess.


# Caused by: java.lang.StackOverflowError
# org.apache.derby.impl.sql.compile.OrNode.bindExpression(Unknown Source)
# org.apache.derby.impl.sql.compile.BinaryOperatorNode.bindExpression(Unknown
Source)
# org.apache.derby.impl.sql.compile.BinaryLogicalOperatorNode.bindExpression(Unknown
Source)
# org.apache.derby.impl.sql.compile.OrNode.bindExpression(Unknown Source)
# org.apache.derby.impl.sql.compile.BinaryOperatorNode.bindExpression(Unknown
Source)
# org.apache.derby.impl.sql.compile.BinaryLogicalOperatorNode.bindExpression(Unknown
Source)
# org.apache.derby.impl.sql.compile.OrNode.bindExpression(Unknown Source)
# org.apache.derby.impl.sql.compile.BinaryOperatorNode.bindExpression(Unknown
Source)
# org.apache.derby.impl.sql.compile.BinaryLogicalOperatorNode.bindExpression(Unknown
Source)


-- 
Øyvind Harboe
http://www.zylin.com/zy1000.html
ARM7 ARM9 XScale Cortex
JTAG debugger and flash programmer

Re: Stack overflow with Derby adapter

Posted by Aristedes Maniatis <ar...@ish.com.au>.
On 12/09/2008, at 5:50 PM, Øyvind Harboe wrote:

> I've got an obscure bug in our app that is caused by a stack
> overflow with Derby.
>
> The problem is that 'OR' is implemented recursively inside Derby, so
> when using ExpressionFactoyr.inExp() w/a *long* list, the stack  
> overflows.
>
>
> Can this be worked around in the Cayenne Derby adapter?

I think you may already have reported this one:

https://issues.apache.org/cayenne/browse/CAY-1079


If you are able to determine the Derby maximum value, we should give  
Cayenne some cleverer defaults. I looked through their docs for this a  
while ago but never found anything.

Ari



-------------------------->
ish
http://www.ish.com.au
Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001   fax +61 2 9550 4001
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A



Re: Stack overflow with Derby adapter

Posted by Øyvind Harboe <oy...@zylin.com>.
On Fri, Sep 12, 2008 at 10:50 AM, Andrus Adamchik
<an...@objectstyle.org> wrote:
> No. And I can't think of a reasonable solution that we can implement on our
> end.

At that point, I think it makes sense to push for a solution in Derby
as there it will
be hard to tell whether all code follows the restrictions in Derby.


-- 
Øyvind Harboe
http://www.zylin.com/zy1000.html
ARM7 ARM9 XScale Cortex
JTAG debugger and flash programmer

Re: Stack overflow with Derby adapter

Posted by Andrus Adamchik <an...@objectstyle.org>.
No. And I can't think of a reasonable solution that we can implement  
on our end.

Andrus

On Sep 12, 2008, at 11:43 AM, Øyvind Harboe wrote:

> On Fri, Sep 12, 2008 at 10:23 AM, Andrus Adamchik
> <an...@objectstyle.org> wrote:
>> This is a known problem on Derby. If this happens inside a  
>> paginated list,
>> here is a workaround (that needs to be ported to the adapter at  
>> some point)
>> :
>>
>> ((IncrementalFaultList) list).setMaxFetchSize(1000);
>> // 1000 is just a random #, you'll need to play with this parameter  
>> to
>> optimize it
>> // default is 10000.
>
> For non-paginated queries there is no solution today?
>
> -- 
> Øyvind Harboe
> http://www.zylin.com/zy1000.html
> ARM7 ARM9 XScale Cortex
> JTAG debugger and flash programmer
>


Re: Stack overflow with Derby adapter

Posted by Øyvind Harboe <oy...@zylin.com>.
On Fri, Sep 12, 2008 at 10:23 AM, Andrus Adamchik
<an...@objectstyle.org> wrote:
> This is a known problem on Derby. If this happens inside a paginated list,
> here is a workaround (that needs to be ported to the adapter at some point)
> :
>
> ((IncrementalFaultList) list).setMaxFetchSize(1000);
> // 1000 is just a random #, you'll need to play with this parameter to
> optimize it
> // default is 10000.

For non-paginated queries there is no solution today?

-- 
Øyvind Harboe
http://www.zylin.com/zy1000.html
ARM7 ARM9 XScale Cortex
JTAG debugger and flash programmer

Re: Stack overflow with Derby adapter

Posted by Andrus Adamchik <an...@objectstyle.org>.
This is a known problem on Derby. If this happens inside a paginated  
list, here is a workaround (that needs to be ported to the adapter at  
some point) :

((IncrementalFaultList) list).setMaxFetchSize(1000);
// 1000 is just a random #, you'll need to play with this parameter to  
optimize it
// default is 10000.

Thanks,
Andrus

On Sep 12, 2008, at 10:50 AM, Øyvind Harboe wrote:

> I've got an obscure bug in our app that is caused by a stack
> overflow with Derby.
>
> The problem is that 'OR' is implemented recursively inside Derby, so
> when using ExpressionFactoyr.inExp() w/a *long* list, the stack  
> overflows.
>
>
> Can this be worked around in the Cayenne Derby adapter?
>
> Should it?
>
> Ideally I'd like to see it worked around in the Cayenne Derby  
> adapter and
> fixed in Derby I guess.
>
>
> # Caused by: java.lang.StackOverflowError
> # org.apache.derby.impl.sql.compile.OrNode.bindExpression(Unknown  
> Source)
> #  
> org 
> .apache 
> .derby.impl.sql.compile.BinaryOperatorNode.bindExpression(Unknown
> Source)
> #  
> org 
> .apache 
> .derby 
> .impl.sql.compile.BinaryLogicalOperatorNode.bindExpression(Unknown
> Source)
> # org.apache.derby.impl.sql.compile.OrNode.bindExpression(Unknown  
> Source)
> #  
> org 
> .apache 
> .derby.impl.sql.compile.BinaryOperatorNode.bindExpression(Unknown
> Source)
> #  
> org 
> .apache 
> .derby 
> .impl.sql.compile.BinaryLogicalOperatorNode.bindExpression(Unknown
> Source)
> # org.apache.derby.impl.sql.compile.OrNode.bindExpression(Unknown  
> Source)
> #  
> org 
> .apache 
> .derby.impl.sql.compile.BinaryOperatorNode.bindExpression(Unknown
> Source)
> #  
> org 
> .apache 
> .derby 
> .impl.sql.compile.BinaryLogicalOperatorNode.bindExpression(Unknown
> Source)
>
>
> -- 
> Øyvind Harboe
> http://www.zylin.com/zy1000.html
> ARM7 ARM9 XScale Cortex
> JTAG debugger and flash programmer
>