History | Log In     View a printable version of the current page. Get help!  
Issue Details [XML]

Key: SES-704
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Arjohn Kampman
Reporter: Nick Giles
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Sesame

Using UNION in a SPARQL query can prevent the time limit from working

Created: 24/Feb/10 03:42 PM   Updated: 18/Mar/10 10:18 AM
Component/s: Query Engine
Affects Version/s: 2.3.0
Fix Version/s: 2.3.2


 Description   
Doing a query of the form:

SELECT DISTINCT * WHERE {
 ?thing1 test:relation ?thing2 .
 {
  OPTIONAL {
   ?thing2 a ?type .
  } FILTER ( ! BOUND ( ?type ) )
 } UNION {
  ?thing2 a test:SomeType .
 }
}

with a timeout of 60 seconds, it fails to be interrupted at the appropriate point. Now, they query is not well designed, but it should still obey the timeout / interruption.

Thread dumps:

"Thread 1" runnable
   java.lang.Thread.State: RUNNABLE
        at info.aduna.lang.ObjectUtil.nullEquals(ObjectUtil.java:29)
        at org.openrdf.sail.memory.model.MemStatementIterator.getNextElement(MemStatementIterator.java:134)
        at org.openrdf.sail.memory.model.MemStatementIterator.getNextElement(MemStatementIterator.java:17)
        at info.aduna.iteration.LookAheadIteration.lookAhead(LookAheadIteration.java:80)
        at info.aduna.iteration.LookAheadIteration.hasNext(LookAheadIteration.java:49)
        at info.aduna.iteration.IterationWrapper.hasNext(IterationWrapper.java:57)
        at info.aduna.iteration.FilterIteration.findNextElement(FilterIteration.java:68)
        at info.aduna.iteration.FilterIteration.hasNext(FilterIteration.java:43)
        at info.aduna.iteration.ConvertingIteration.hasNext(ConvertingIteration.java:62)
        at org.openrdf.query.algebra.evaluation.iterator.LeftJoinIterator.getNextElement(LeftJoinIterator.java:69)
        at org.openrdf.query.algebra.evaluation.iterator.BadlyDesignedLeftJoinIterator.getNextElement(BadlyDesignedLeftJoinIterator.java:55)
        at org.openrdf.query.algebra.evaluation.iterator.BadlyDesignedLeftJoinIterator.getNextElement(BadlyDesignedLeftJoinIterator.java:20)
        at info.aduna.iteration.LookAheadIteration.lookAhead(LookAheadIteration.java:80)
        at info.aduna.iteration.LookAheadIteration.hasNext(LookAheadIteration.java:49)
        at info.aduna.iteration.IterationWrapper.hasNext(IterationWrapper.java:57)
        at info.aduna.iteration.FilterIteration.findNextElement(FilterIteration.java:68)
        at info.aduna.iteration.FilterIteration.hasNext(FilterIteration.java:43)
        at org.openrdf.query.algebra.evaluation.iterator.JoinIterator.getNextElement(JoinIterator.java:58)
        at org.openrdf.query.algebra.evaluation.iterator.JoinIterator.getNextElement(JoinIterator.java:19)
        at info.aduna.iteration.LookAheadIteration.lookAhead(LookAheadIteration.java:80)
        at info.aduna.iteration.LookAheadIteration.hasNext(LookAheadIteration.java:49)
        at info.aduna.iteration.DelayedIteration.hasNext(DelayedIteration.java:67)
        at info.aduna.iteration.UnionIteration.getNextElement(UnionIteration.java:63)
        at info.aduna.iteration.UnionIteration.getNextElement(UnionIteration.java:73)
        - locked <0x00007f7c7ebd0078> (a info.aduna.iteration.UnionIteration)
        at info.aduna.iteration.LookAheadIteration.lookAhead(LookAheadIteration.java:80)
        at info.aduna.iteration.LookAheadIteration.hasNext(LookAheadIteration.java:49)
        at info.aduna.iteration.ConvertingIteration.hasNext(ConvertingIteration.java:62)
        at info.aduna.iteration.IterationWrapper.hasNext(IterationWrapper.java:57)
        at info.aduna.iteration.FilterIteration.findNextElement(FilterIteration.java:68)
        at info.aduna.iteration.FilterIteration.hasNext(FilterIteration.java:43)
        at info.aduna.iteration.IterationWrapper.hasNext(IterationWrapper.java:57)
        at info.aduna.iteration.LimitIteration.hasNext(LimitIteration.java:62)
        at info.aduna.iteration.IterationWrapper.hasNext(IterationWrapper.java:57)
        at info.aduna.iteration.LockingIteration.hasNext(LockingIteration.java:61)
        - locked <0x00007f7c7ebd00f8> (a info.aduna.iteration.LockingIteration)
        at info.aduna.iteration.IterationWrapper.hasNext(IterationWrapper.java:57)
        at org.openrdf.sail.helpers.SailBaseIteration.hasNext(SailBaseIteration.java:50)
        at info.aduna.iteration.IterationWrapper.hasNext(IterationWrapper.java:57)
        at info.aduna.iteration.TimeLimitIteration.hasNext(TimeLimitIteration.java:57)
        at org.openrdf.query.impl.TupleQueryResultImpl.hasNext(TupleQueryResultImpl.java:90)



"TimeLimitIteration" daemon waiting for monitor entry [0x000000005734a000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at info.aduna.iteration.UnionIteration.handleClose(UnionIteration.java:90)
        - waiting to lock <0x00007f7c7ebd0078> (a info.aduna.iteration.UnionIteration)
        at info.aduna.iteration.CloseableIterationBase.close(CloseableIterationBase.java:50)
        at info.aduna.iteration.Iterations.closeCloseable(Iterations.java:93)
        at info.aduna.iteration.ConvertingIteration.handleClose(ConvertingIteration.java:106)
        at info.aduna.iteration.CloseableIterationBase.close(CloseableIterationBase.java:50)
        at info.aduna.iteration.Iterations.closeCloseable(Iterations.java:93)
        at info.aduna.iteration.IterationWrapper.handleClose(IterationWrapper.java:101)
        at info.aduna.iteration.FilterIteration.handleClose(FilterIteration.java:95)
        at info.aduna.iteration.CloseableIterationBase.close(CloseableIterationBase.java:50)
        at info.aduna.iteration.Iterations.closeCloseable(Iterations.java:93)
        at info.aduna.iteration.IterationWrapper.handleClose(IterationWrapper.java:101)
        at info.aduna.iteration.CloseableIterationBase.close(CloseableIterationBase.java:50)
        at info.aduna.iteration.Iterations.closeCloseable(Iterations.java:93)
        at info.aduna.iteration.IterationWrapper.handleClose(IterationWrapper.java:101)
        at info.aduna.iteration.LockingIteration.handleClose(LockingIteration.java:96)
        at info.aduna.iteration.CloseableIterationBase.close(CloseableIterationBase.java:50)
        at info.aduna.iteration.Iterations.closeCloseable(Iterations.java:93)
        at info.aduna.iteration.IterationWrapper.handleClose(IterationWrapper.java:101)
        at org.openrdf.sail.helpers.SailBaseIteration.handleClose(SailBaseIteration.java:64)
        at info.aduna.iteration.CloseableIterationBase.close(CloseableIterationBase.java:50)
        at info.aduna.iteration.Iterations.closeCloseable(Iterations.java:93)
        at info.aduna.iteration.IterationWrapper.handleClose(IterationWrapper.java:101)
        at info.aduna.iteration.TimeLimitIteration.handleClose(TimeLimitIteration.java:89)
        at info.aduna.iteration.CloseableIterationBase.close(CloseableIterationBase.java:50)
        at info.aduna.iteration.TimeLimitIteration.interrupt(TimeLimitIteration.java:108)
        at info.aduna.iteration.TimeLimitIteration.access$000(TimeLimitIteration.java:19)
        at info.aduna.iteration.TimeLimitIteration$1.run(TimeLimitIteration.java:45)
        at java.util.TimerThread.mainLoop(Timer.java:512)
        at java.util.TimerThread.run(Timer.java:462)

 All   Comments   Change History      Sort Order:
Comment by Arjohn Kampman [18/Mar/10 10:18 AM]
In UnionIterator, handleClose() blocked on the synchronized block because getNextElement() entered the recursion while keeping hold of this lock.