You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Steve Pannier <St...@jacada.com> on 2003/02/17 20:58:48 UTC

[JXPath] Infinite loop in iterator.hasNext()

I've run into a problem with iterating through the result set after
calling context.iterate().  As I'm iterating, the hasNext() method
in my while loop conditional seems to get into an infinite loop.
(I get several java.lang.OutOfMemoryError's - no stack trace
available.)  I did get a stack dump by sending the Unix QUIT
signal to my running process, and the result of that is shown
here:

.
.
.
Feb 17, 2003 12:29:18 PM CST: at
org.apache.commons.jxpath.ri.model.NodePointer.clone(NodePointer.java:644)
Feb 17, 2003 12:29:18 PM CST: at
org.apache.commons.jxpath.ri.model.NodePointer.clone(NodePointer.java:644)
Feb 17, 2003 12:29:18 PM CST: at
org.apache.commons.jxpath.ri.model.NodePointer.clone(NodePointer.java:644)
Feb 17, 2003 12:29:18 PM CST: at
org.apache.commons.jxpath.ri.model.NodePointer.clone(NodePointer.java:644)
Feb 17, 2003 12:29:18 PM CST: at
org.apache.commons.jxpath.ri.model.NodePointer.clone(NodePointer.java:644)
Feb 17, 2003 12:29:18 PM CST: at
org.apache.commons.jxpath.ri.model.NodePointer.clone(NodePointer.java:644)
Feb 17, 2003 12:29:18 PM CST: at
org.apache.commons.jxpath.ri.model.NodePointer.clone(NodePointer.java:644)
Feb 17, 2003 12:29:18 PM CST: at
org.apache.commons.jxpath.ri.model.NodePointer.clone(NodePointer.java:644)
Feb 17, 2003 12:29:18 PM CST: at
org.apache.commons.jxpath.ri.model.beans.PropertyIterator.getNodePointer(PropertyIterator.java:152)
Feb 17, 2003 12:29:18 PM CST: at
org.apache.commons.jxpath.ri.axes.DescendantContext.nextNode(DescendantContext.java:151)
Feb 17, 2003 12:29:18 PM CST: at
org.apache.commons.jxpath.ri.EvalContext.nextSet(EvalContext.java:349)
Feb 17, 2003 12:29:18 PM CST: at
org.apache.commons.jxpath.ri.EvalContext.nextSet(EvalContext.java:355)
Feb 17, 2003 12:29:18 PM CST: at
org.apache.commons.jxpath.ri.axes.PredicateContext.nextSet(PredicateContext.java:201)
Feb 17, 2003 12:29:18 PM CST: at
org.apache.commons.jxpath.ri.EvalContext.performIteratorStep(EvalContext.java:192)
Feb 17, 2003 12:29:18 PM CST: at
org.apache.commons.jxpath.ri.EvalContext.hasNext(EvalContext.java:151)
Feb 17, 2003 12:29:18 PM CST: at
org.apache.commons.jxpath.ri.compiler.Expression$ValueIterator.hasNext(Expression.java:171)
Feb 17, 2003 12:29:18 PM CST: at
com.jacada.ji.type.Util.doXPathAssignment(Util.java:866)



Our context root is a Map, and we are trying to evaluate the
expression "//A/B[@attr='value']", where the "A/B" structure
is located at different levels throughout the Map.  For example,
"/Foo/A/B", "/Foo/Bar/Baz/A/B", etc.

I'm running with the nightly build commons-jxpath.jar.  I was
first using the one from Jan 7, but downloaded the Feb 14
version on Friday and saw no difference in behavior.

I've seen this problem when running within our proprietary
runtime environment.  I'm currently working on putting a
simple test case together that shows the problem.  I had
my test case working on Friday, but I made some changes
to clean it up, and for some reason today I can't seem to
recreate the problem.  I will forward it here once I get it
working again.


Steve Pannier
Jacada, Inc.
(763) 201-0002 Ext. 219
spannier@jacada.com
http://www.jacada.com



Re: [JXPath] Infinite loop in iterator.hasNext()

Posted by Dmitri Plotnikov <dm...@apache.org>.
I will wait for you test case before start seriously looking into this.

Here's something that might help.  If you have a graph with a loop (A points
to B and B points to A, directly or otherwise), and you launch a search like
this: "//foo", the whole thing has a good chance of falling into an infinite
loop, creating pointers of ever growing length.  I have a plan to introduce
some automated detection of this situation, but at this point it will simply
lead to an OutOfMemoryError.  Could this be it?

- Dmitri

----- Original Message -----
From: "Steve Pannier" <St...@jacada.com>
To: <co...@jakarta.apache.org>
Sent: Monday, February 17, 2003 2:58 PM
Subject: [JXPath] Infinite loop in iterator.hasNext()


> I've run into a problem with iterating through the result set after
> calling context.iterate().  As I'm iterating, the hasNext() method
> in my while loop conditional seems to get into an infinite loop.
> (I get several java.lang.OutOfMemoryError's - no stack trace
> available.)  I did get a stack dump by sending the Unix QUIT
> signal to my running process, and the result of that is shown
> here:
>
> .
> .
> .
> Feb 17, 2003 12:29:18 PM CST: at
> org.apache.commons.jxpath.ri.model.NodePointer.clone(NodePointer.java:644)
> Feb 17, 2003 12:29:18 PM CST: at
> org.apache.commons.jxpath.ri.model.NodePointer.clone(NodePointer.java:644)
> Feb 17, 2003 12:29:18 PM CST: at
> org.apache.commons.jxpath.ri.model.NodePointer.clone(NodePointer.java:644)
> Feb 17, 2003 12:29:18 PM CST: at
> org.apache.commons.jxpath.ri.model.NodePointer.clone(NodePointer.java:644)
> Feb 17, 2003 12:29:18 PM CST: at
> org.apache.commons.jxpath.ri.model.NodePointer.clone(NodePointer.java:644)
> Feb 17, 2003 12:29:18 PM CST: at
> org.apache.commons.jxpath.ri.model.NodePointer.clone(NodePointer.java:644)
> Feb 17, 2003 12:29:18 PM CST: at
> org.apache.commons.jxpath.ri.model.NodePointer.clone(NodePointer.java:644)
> Feb 17, 2003 12:29:18 PM CST: at
> org.apache.commons.jxpath.ri.model.NodePointer.clone(NodePointer.java:644)
> Feb 17, 2003 12:29:18 PM CST: at
>
org.apache.commons.jxpath.ri.model.beans.PropertyIterator.getNodePointer(Pro
pertyIterator.java:152)
> Feb 17, 2003 12:29:18 PM CST: at
>
org.apache.commons.jxpath.ri.axes.DescendantContext.nextNode(DescendantConte
xt.java:151)
> Feb 17, 2003 12:29:18 PM CST: at
> org.apache.commons.jxpath.ri.EvalContext.nextSet(EvalContext.java:349)
> Feb 17, 2003 12:29:18 PM CST: at
> org.apache.commons.jxpath.ri.EvalContext.nextSet(EvalContext.java:355)
> Feb 17, 2003 12:29:18 PM CST: at
>
org.apache.commons.jxpath.ri.axes.PredicateContext.nextSet(PredicateContext.
java:201)
> Feb 17, 2003 12:29:18 PM CST: at
>
org.apache.commons.jxpath.ri.EvalContext.performIteratorStep(EvalContext.jav
a:192)
> Feb 17, 2003 12:29:18 PM CST: at
> org.apache.commons.jxpath.ri.EvalContext.hasNext(EvalContext.java:151)
> Feb 17, 2003 12:29:18 PM CST: at
>
org.apache.commons.jxpath.ri.compiler.Expression$ValueIterator.hasNext(Expre
ssion.java:171)
> Feb 17, 2003 12:29:18 PM CST: at
> com.jacada.ji.type.Util.doXPathAssignment(Util.java:866)
>
>
>
> Our context root is a Map, and we are trying to evaluate the
> expression "//A/B[@attr='value']", where the "A/B" structure
> is located at different levels throughout the Map.  For example,
> "/Foo/A/B", "/Foo/Bar/Baz/A/B", etc.
>
> I'm running with the nightly build commons-jxpath.jar.  I was
> first using the one from Jan 7, but downloaded the Feb 14
> version on Friday and saw no difference in behavior.
>
> I've seen this problem when running within our proprietary
> runtime environment.  I'm currently working on putting a
> simple test case together that shows the problem.  I had
> my test case working on Friday, but I made some changes
> to clean it up, and for some reason today I can't seem to
> recreate the problem.  I will forward it here once I get it
> working again.
>
>
> Steve Pannier
> Jacada, Inc.
> (763) 201-0002 Ext. 219
> spannier@jacada.com
> http://www.jacada.com
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>