Return-Path: Delivered-To: apmail-jackrabbit-users-archive@locus.apache.org Received: (qmail 81595 invoked from network); 16 Jul 2008 12:16:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Jul 2008 12:16:36 -0000 Received: (qmail 58808 invoked by uid 500); 16 Jul 2008 12:16:34 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 58782 invoked by uid 500); 16 Jul 2008 12:16:34 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 58762 invoked by uid 99); 16 Jul 2008 12:16:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Jul 2008 05:16:34 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of bfitzgibbons@techtarget.com designates 65.214.43.183 as permitted sender) Received: from [65.214.43.183] (HELO mailfilter-01.techtarget.com) (65.214.43.183) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Jul 2008 12:15:35 +0000 Received: from KYLE.office.techtarget.com (kyle.office.techtarget.com [192.168.0.55]) by mailfilter-01.techtarget.com (8.14.1/8.14.1) with ESMTP id m6GCDwdi031536 for ; Wed, 16 Jul 2008 08:13:58 -0400 Received: from atl-mes1.office.techtarget.com ([10.12.1.36]) by KYLE.office.techtarget.com with Microsoft SMTPSVC(6.0.3790.1830); Wed, 16 Jul 2008 08:13:58 -0400 Received: from atl-mes1.office.techtarget.com ([10.12.1.36]) by atl-mes1.office.techtarget.com ([10.12.1.36]) with mapi; Wed, 16 Jul 2008 08:13:58 -0400 From: "Fitzgibbons, Brad" To: "users@jackrabbit.apache.org" Date: Wed, 16 Jul 2008 08:13:57 -0400 Subject: RE: RowIterator.next() fails when hasNext() returns true Thread-Topic: RowIterator.next() fails when hasNext() returns true Thread-Index: AcjnJLs0/EME44TGRPCQBZRrAJjuFwAGCz7Q Message-ID: References: <487B0FD0.10300@gmx.net> <487B493A.7080309@gmx.net> <487DBC34.5060400@gmx.net> In-Reply-To: <487DBC34.5060400@gmx.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginalArrivalTime: 16 Jul 2008 12:13:58.0106 (UTC) FILETIME=[6C9933A0:01C8E73D] X-Proofpoint-Virus-Version: vendor=fsecure engine=1.12.7160:2.4.4,1.2.40,4.0.166 definitions=2008-07-16_04:2008-07-15,2008-07-16,2008-07-16 signatures=0 X-Virus-Checked: Checked by ClamAV on apache.org I'll try to find some time to spin something up, but it's likely to be awhi= le before I can find the bandwidth to do so. As soon as I can I'll submit = a repeatable, non-proprietary example of the problem. As an aside, I've thoroughly enjoyed working with the JCR standard and Jack= rabbit. Thanks for all the work you and others have put into this. brad -----Original Message----- From: Marcel Reutegger [mailto:marcel.reutegger@gmx.net] Sent: Wednesday, July 16, 2008 5:16 AM To: users@jackrabbit.apache.org Subject: Re: RowIterator.next() fails when hasNext() returns true Hi Brad, are you able to extract this into simple test program without dependencies = to your application? that would be great. regards marcel Fitzgibbons, Brad wrote: > Yes, it's threadsafe. Each visit to the URL invokes the resourceQueryAnd= Print() method. This method is wrapped in a JTA transaction, and results i= n the following actions: > (1) Execute a new SQL query on the JCR session (using spring-modules = to provide session). > (2) Create a new instance of PropertyIterator which wraps the RowIter= ator from the query. > (3) Perform the loop as shown and print some of the metadata from eac= h element in the result set. > (a) Each call to PropertyIterator.hasNext() delegates to RowItera= tor.hasNext(). > (a) Each call to PropertyIterator.next() will marshall data from = the Row returned by RowIterator.next() into a DTO. > > Here's an example of the SQL query (with actual property names and node p= rimary type changed): > select A,B,C,D from custom_type where (A=3D'A1' or A=3D'A2' or A=3D'A= 3') > and (contains(B, 'XXX') or contains(C, 'XXX')) order by D > > Changing the properties in the select clause or the order by clause (but = leaving the where clause as-is) will sometimes produce iterators that do no= t have the hasNext/next behavior I've described. > > > -----Original Message----- > From: Marcel Reutegger [mailto:marcel.reutegger@gmx.net] > Sent: Monday, July 14, 2008 8:40 AM > To: users@jackrabbit.apache.org > Subject: Re: RowIterator.next() fails when hasNext() returns true > > Hi, > > hmm, let's check something else... what about your class ProfileControlle= r, is it thread-safe? is it possible that two threads concurrently call has= Next/next? > is PropertyIterator in ProfileController an instance variable? > > regards > marcel > > Fitzgibbons, Brad wrote: >> Yes. My loop breaks down to this: >> >> while (iterator.hasNext()) { >> Object obj =3D iterator.next(); >> ... >> } >> >> However, if I do this instead I get (what appears to be) "normal" behavi= or (except that getSize() is often much less than the actual result set siz= e): >> >> while (iterator.hasNext()) { >> try { >> Object obj =3D iterator.next(); >> } catch (NoSuchElementException excp) { /* masked */ } } >> >> Thanks! >> brad >> >> -----Original Message----- >> From: Marcel Reutegger [mailto:marcel.reutegger@gmx.net] >> Sent: Monday, July 14, 2008 4:35 AM >> To: users@jackrabbit.apache.org >> Subject: Re: RowIterator.next() fails when hasNext() returns true >> >> Hi, >> >> this seems very strange because LazyScoreNodeIterator always pre-fetches= the next node. so whenever you call hasNext() and it returns true LazyScor= eNodeIterator already has the next node and does not have to fetch it on ne= xtRow(). >> >> Can you please double check that you always call hasNext() before you >> call >> nextRow() ? >> >> regards >> marcel >> >> Fitzgibbons, Brad wrote: >>> I'm running into this problem occasionally resulting in the >>> exception below. I'm using Jackrabbit 1.4 (with core at 1.4.2). >>> I'm using the H2PersistenceManager and almost all configuration >>> values are set to their released default. Document order is turned >>> off so the query is using a LazyScoreNodeIterator. I'm running in a >>> transactional environment, and my entire execution flow is contained >>> by a single, read-only, JTA transaction. The single transaction >>> includes executing the query and all interactions with the returned >>> RowIterator. If I ignore the NoSuchElementException's and continue >>> using the iterator then there are often good results subsequent to >>> the error. I've noticed that when these errors occur there are >>> often far more results than are returned by RowIterator.getSize(). >>> I realize that getSize() is not meant to be an accurate count of all >>> results, but in most other cases getSize() is greater than the size >>> of the result set (this may not be helpful). I'm using >> a SQL query that involves the CONTAINS constraint (so lucene) and order= ing by jcr:score. Does this warrant a bug submission? Is there any additi= onal information which might help? >>> org.springframework.web.util.NestedServletException: Request processing= failed; nested exception is java.util.NoSuchElementException >>> at org.springframework.web.servlet.FrameworkServlet.processRequ= est(FrameworkServlet.java:535) >>> at org.springframework.web.servlet.FrameworkServlet.doGet(Frame= workServlet.java:453) >>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:114) >>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:91) >>> at com.caucho.server.dispatch.ServletFilterChain.doFilter(Servl= etFilterChain.java:103) >>> at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFi= lterChain.java:181) >>> at com.caucho.server.dispatch.ServletInvocation.service(Servlet= Invocation.java:266) >>> at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest= .java:269) >>> at com.caucho.server.port.TcpConnection.run(TcpConnection.java:= 603) >>> at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:721= ) >>> at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:643) >>> at java.lang.Thread.run(Thread.java:619) >>> Caused by: java.util.NoSuchElementException >>> at org.apache.jackrabbit.core.query.lucene.QueryResultImpl$Lazy= ScoreNodeIterator.getScore(QueryResultImpl.java:351) >>> at org.apache.jackrabbit.core.query.lucene.RowIteratorImpl.next= Row(RowIteratorImpl.java:153) >>> at com.techtarget.content.data.jcr1.ElementDaoImpl.nextElement(= ElementDaoImpl.java:722) >>> at com.techtarget.content.data.jcr1.PropertyIterator.next(Prope= rtyIterator.java:47) >>> at com.techtarget.content.data.jcr1.PropertyIterator.next(Prope= rtyIterator.java:21) >>> at com.techtarget.content.web.controller.ProfileController.reso= urceQueryAndPrint(ProfileController.java:125) >>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce= ssorImpl.java:39) >>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe= thodAccessorImpl.java:25) >>> at java.lang.reflect.Method.invoke(Method.java:597) >>> at org.springframework.web.bind.annotation.support.HandlerMetho= dInvoker.doInvokeMethod(HandlerMethodInvoker.java:305) >>> at org.springframework.web.bind.annotation.support.HandlerMetho= dInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:131) >>> at org.springframework.web.servlet.mvc.annotation.AnnotationMet= hodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:3= 08) >>> at org.springframework.web.servlet.mvc.annotation.AnnotationMet= hodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:295) >>> at org.springframework.web.servlet.DispatcherServlet.doDispatch= (DispatcherServlet.java:874) >>> at org.springframework.web.servlet.DispatcherServlet.doService(= DispatcherServlet.java:808) >>> at org.springframework.web.servlet.FrameworkServlet.processRequ= est(FrameworkServlet.java:523) >>> at org.springframework.web.servlet.FrameworkServlet.doGet(Frame= workServlet.java:453) >>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:114) >>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:91) >>> at com.caucho.server.dispatch.ServletFilterChain.doFilter(Servl= etFilterChain.java:103) >>> at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFi= lterChain.java:181) >>> at com.caucho.server.dispatch.ServletInvocation.service(Servlet= Invocation.java:266) >>> at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest= .java:269) >>> at com.caucho.server.port.TcpConnection.run(TcpConnection.java:= 603) >>> at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:721= ) >>> at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:643) >>> at java.lang.Thread.run(Thread.java:619) >>> >>> Brad Fitzgibbons >>> Senior Software Engineer >>> Tech Target >>> The Most Targeted IT Media >>> http://www.techtarget.com/ >>> >>> >>> >> > >