Marc Prud wrote: > > What happens if you synchronized on the result collection when > iterating through them? >
Unfortunately I don't have that fine-grained access since the result set is iterated by a JSF dataTable. I can, however, synchronize access by using a per-session mutex on the entire JSF Render Response phase. It solves the problem, but is probably a bit of overkill. I did try adding the synchronized keyword to all the org.apache.openjpa.kernel.DelegatingResultList methods, but it didn't work and I was really just stabbing in the dark. All this synchronizing makes me hungry. > On Dec 12, 2006, at 7:44 PM, roger.keays wrote: > >> >> Hi Marc, >> >> >> Marc Prud wrote: >>> >>> Was a transaction committed or rolled back between the two requests? >>> Many databases and/or JDBC drivers do not allow a result set cursor >>> to span multiple transactions, which might be the cause of this error >>> (which, admittedly, we are not handling as gracefully as we could >>> be). >>> >> >> No, there is no SQL activity between the requests except for that >> produced >> by the LRS. I suspected it could be a JDBC driver issue which is >> why I tried >> MySQL also. I see pretty well the exact same behaviour on MySQL >> though. >> >> It seems that the result list is closing because of an exception >> caused by >> two threads both trying to use the database connection at the same >> time. The >> first exception is usually a nonsensical one from the JDBC driver - >> NullPointerException, stuff about BigDecimals (of which I use >> none), SQL >> errors - "portal c_8 does not exist' (?). >> >> The only constant I can find is that it works fine if I load the >> frames one >> by one, so my best guess is it is a concurrency issue. >> >> Thanks, >> >> Roger >> >> >>> On Dec 12, 2006, at 6:26 PM, roger.keays wrote: >>> >>>> >>>> Now that I have an em which lives for longer than one request (as >>>> per my >>>> previous thread) I have noticed some concurrency issues accessing >>>> the large >>>> result set. Since my app uses frames, there are occasions when two >>>> frames >>>> will be refreshed at the same time. When this occurs, and the both >>>> try to >>>> iterate the LRS I will frequently get either a >>>> NullPointerException or >>>> NoSuchElementException (result list is closed). Loading the frames >>>> one by >>>> one works fine. >>>> >>>> I've tried to the following with no avail: >>>> * Adding openjpa.Multithreaded=true >>>> * Synchronizing the LRS' getter method >>>> * Removing connection pooling (i.e. use openjpa's datasource) >>>> * Using mysql instead of postgresql >>>> * Disabling the query cache >>>> * Disabling the data cache >>>> >>>> As you can see, I'm a bit stuck. Any suggestions welcome. >>>> >>>> The NullPointerException stacktrace is: >>>> >>>> java.lang.NullPointerException >>>> >>>> org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.next >>>> (SelectResultObjectProvider.java:96) >>>> >>>> org.apache.openjpa.lib.rop.WindowResultList.getInternal >>>> (WindowResultList.java:126) >>>> >>>> org.apache.openjpa.lib.rop.AbstractNonSequentialResultList.get >>>> (AbstractNonSequentialResultList.java:69) >>>> >>>> org.apache.openjpa.kernel.DelegatingResultList.get >>>> (DelegatingResultList.java:241) >>>> javax.faces.model.ListDataModel.getRowData(ListDataModel.java:141) >>>> javax.faces.model.ListDataModel.setRowIndex(ListDataModel.java:175) >>>> javax.faces.model.ListDataModel.setWrappedData(ListDataModel.java: >>>> 209) >>>> javax.faces.model.ListDataModel.<init>(ListDataModel.java:68) >>>> >>>> org.apache.myfaces.component.html.ext.HtmlDataTableHack.createDataMo >>>> de >>>> l(HtmlDataTableHack.java:448) >>>> >>>> org.apache.myfaces.component.html.ext.HtmlDataTable.createDataModel >>>> (HtmlDataTable.java:847) >>>> >>>> org.apache.myfaces.component.html.ext.HtmlDataTableHack.getDataModel >>>> (HtmlDataTableHack.java:414) >>>> >>>> org.apache.myfaces.component.html.ext.HtmlDataTable.getDataModel >>>> (HtmlDataTable.java:839) >>>> >>>> org.apache.myfaces.component.html.ext.HtmlDataTableHack.getRowCount >>>> (HtmlDataTableHack.java:87) >>>> >>>> org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTableRendererB >>>> as >>>> e.encodeInnerHtml(HtmlTableRendererBase.java:226) >>>> >>>> org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTableRendererB >>>> as >>>> e.encodeChildren(HtmlTableRendererBase.java:134) >>>> >>>> org.apache.myfaces.renderkit.html.ext.HtmlTableRenderer.encodeChildr >>>> en >>>> (HtmlTableRenderer.java:187) >>>> >>>> javax.faces.component.UIComponentBase.encodeChildren >>>> (UIComponentBase.java:828) >>>> javax.faces.component.UIComponent.encodeAll(UIComponent.java:883) >>>> javax.faces.component.UIComponent.encodeAll(UIComponent.java:889) >>>> com.sun.facelets.FaceletViewHandler.renderView >>>> (FaceletViewHandler.java:578) >>>> >>>> and the NoSuchElementException: >>>> >>>> java.util.NoSuchElementException: The result list has been closed. >>>> >>>> org.apache.openjpa.lib.rop.AbstractResultList.assertOpen >>>> (AbstractResultList.java:91) >>>> org.apache.openjpa.lib.rop.WindowResultList.size >>>> (WindowResultList.java:81) >>>> >>>> org.apache.openjpa.kernel.DelegatingResultList.size >>>> (DelegatingResultList.java:133) >>>> javax.faces.model.ListDataModel.isRowAvailable >>>> (ListDataModel.java:99) >>>> javax.faces.model.ListDataModel.setRowIndex(ListDataModel.java:174) >>>> >>>> org.apache.myfaces.component.html.ext.HtmlDataTableHack.setRowIndex >>>> (HtmlDataTableHack.java:243) >>>> >>>> org.apache.myfaces.component.html.ext.HtmlDataTable.setRowIndex >>>> (HtmlDataTable.java:263) >>>> >>>> org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTableRendererB >>>> as >>>> e.encodeInnerHtml(HtmlTableRendererBase.java:257) >>>> >>>> org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTableRendererB >>>> as >>>> e.encodeChildren(HtmlTableRendererBase.java:134) >>>> >>>> org.apache.myfaces.renderkit.html.ext.HtmlTableRenderer.encodeChildr >>>> en >>>> (HtmlTableRenderer.java:187) >>>> >>>> javax.faces.component.UIComponentBase.encodeChildren >>>> (UIComponentBase.java:828) >>>> javax.faces.component.UIComponent.encodeAll(UIComponent.java:883) >>>> javax.faces.component.UIComponent.encodeAll(UIComponent.java:889) >>>> com.sun.facelets.FaceletViewHandler.renderView >>>> (FaceletViewHandler.java:578) >>>> >>>> Cheers, >>>> >>>> Roger >>>> -- >>>> View this message in context: http://www.nabble.com/concurrent- >>>> access-to-LRS-tf2811717.html#a7846241 >>>> Sent from the open-jpa-dev mailing list archive at Nabble.com. >>>> >>> >>> >>> >> >> -- >> View this message in context: http://www.nabble.com/concurrent- >> access-to-LRS-tf2811717.html#a7846763 >> Sent from the open-jpa-dev mailing list archive at Nabble.com. >> > > > -- View this message in context: http://www.nabble.com/concurrent-access-to-LRS-tf2811717.html#a7849597 Sent from the open-jpa-dev mailing list archive at Nabble.com.