sanjay gopalakrishnan created METAMODEL-122:
-----------------------------------------------

             Summary: org.apache.metamodel.data.RowPublisherImpl.next() 
throwing java.lang.StackOverflowError
                 Key: METAMODEL-122
                 URL: https://issues.apache.org/jira/browse/METAMODEL-122
             Project: Apache MetaModel
          Issue Type: Bug
    Affects Versions: 4.3.2
            Reporter: sanjay gopalakrishnan


The RowPublisherImpl.next() implementation seems to be buggy, with it calling 
itself recursively without any controls.

java.lang.StackOverflowError: null
        at 
java.lang.IllegalMonitorStateException.<init>(IllegalMonitorStateException.java:50)
        at 
java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(ReentrantLock.java:155)
        at 
java.util.concurrent.locks.AbstractQueuedSynchronizer.release(AbstractQueuedSynchronizer.java:1260)
        at 
java.util.concurrent.locks.ReentrantLock.unlock(ReentrantLock.java:460)
        at 
java.util.concurrent.ArrayBlockingQueue.poll(ArrayBlockingQueue.java:393)
        at 
org.apache.metamodel.data.RowPublisherImpl.next(RowPublisherImpl.java:100)
        at 
org.apache.metamodel.data.RowPublisherImpl.next(RowPublisherImpl.java:114)
        at 
org.apache.metamodel.data.RowPublisherImpl.next(RowPublisherImpl.java:114)
        at 
org.apache.metamodel.data.RowPublisherImpl.next(RowPublisherImpl.java:114)
        at 
org.apache.metamodel.data.RowPublisherImpl.next(RowPublisherImpl.java:114)
        at 
org.apache.metamodel.data.RowPublisherImpl.next(RowPublisherImpl.java:114)
        at 
org.apache.metamodel.data.RowPublisherImpl.next(RowPublisherImpl.java:114)
        at 
org.apache.metamodel.data.RowPublisherImpl.next(RowPublisherImpl.java:114)
        at 
org.apache.metamodel.data.RowPublisherImpl.next(RowPublisherImpl.java:114)
        at 
org.apache.metamodel.data.RowPublisherImpl.next(RowPublisherImpl.java:114)
...
...
...

I see two observations..
1. recursion of next() is risky, if there is slow publishing data source.
2. _finished may not being set under some scenario, wherein the data set 
iteration is going in endless loop.


More logs for some diagnostics..
2015-03-18 00:48:20.104  INFO 908 --- [nio-8209-exec-9] 
o.a.metamodel.data.RowPublisherDataSet   : Starting separate thread for 
publishing action: org.apache.metamodel.xml.XmlSa
xDataContext$3@de66a04

2015-03-18 06:45:32.134 ERROR 908 --- [nio-8209-exec-9] 
o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet 
[dispatcherServlet] in context with path [] thre
w exception [Handler processing failed; nested exception is 
java.lang.StackOverflowError] with root cause

Potentially a slow or defunct handle to the http data source (rest service), is 
getting killed eventually after a long time but the stack overflow error.

Might be better to loop not more than 100 odd times, and then return false.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to