Found problem when use QueryIterator or findEach.

21 views
Skip to first unread message

王建旭

unread,
May 22, 2015, 1:40:55 PM5/22/15
to eb...@googlegroups.com
Hi, Rob:

My ebean is 4.6.2.

I have a model named "UserEntLink", which has 2 ref model: User and Enterprise, they are all one2many

This is my query:
Inline image 1

When I use getEntUserQuery(entId).findList();
It's ok.

but when I use QueryIterator or findEach, it will throw exception:

javax.persistence.PersistenceException: Query threw SQLExcep
tion:Streaming result set com.mysql.jdbc.RowDataDynamic@26c8d863 is still active. No statements may be issued when any streaming result sets are open and in use
 on a given connection. Ensure that you have called .close() on any active streaming result sets before attempting more queries. 

This is the code:
Inline image 2 
and:
Inline image 3

I remove the fetch prop from query:
Inline image 4
It's ok, but the query too much.


Daryl Stultz

unread,
May 22, 2015, 1:47:16 PM5/22/15
to eb...@googlegroups.com
On Fri, May 22, 2015 at 1:40 PM, 王建旭 <wji...@gmail.com> wrote:
Hi, Rob:

My ebean is 4.6.2.

I have a model named "UserEntLink", which has 2 ref model: User and Enterprise, they are all one2many

Hi, I'd like to suggest that instead of screen shots you paste the code in text form. This will allow people to edit it and allow search engines to read it.

/Daryl

王建旭

unread,
May 22, 2015, 1:48:58 PM5/22/15
to eb...@googlegroups.com

On Sat, May 23, 2015 at 1:47 AM, Daryl Stultz <kungfum...@gmail.com> wrote:
Hi, I'd like to suggest that instead of screen shots you paste the code in text form. This will allow people to edit it and allow search engines to read it.

​ok, I will use plain code for later.​

Rob Bygrave

unread,
May 22, 2015, 8:41:22 PM5/22/15
to ebean@googlegroups
Can you include more of the stack trace?

I'm 99% sure this is a MySQL specific issue with the QueryIterator and additional "query joins" (fetching the 'user' path).  With MySQL we adjust the jdbc call to ensure the mysql jdbc driver streams the result (which is what you want on large resultSets) ... and it looks like the secondary query to fetch the "user" path is causing this specific error but using the same jdbc connection.

I'd like to see the full stack trace to confirm my thoughts on this issue.


Thanks, Rob.

--

---
You received this message because you are subscribed to the Google Groups "Ebean ORM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ebean+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

王建旭

unread,
May 23, 2015, 8:11:17 AM5/23/15
to eb...@googlegroups.com

Exception here:

Request processing failed; nested exception is javax.persistence.Per

sistenceException: Query threw SQLException:Streaming result set com.mysql.jdbc.RowDataDynamic@3ef4415f is still active. No statements may be issued when any st

reaming result sets are open and in use on a given connection. Ensure that you have called .close() on any active streaming result sets before attempting more q

ueries. 

Bind values:[cf07a34f-31c7-459a-aaca-6f35b387ec7f,a0931584-b670-4ea2-bf5a-654041af38d2,da116ffd-0574-4407-917c-859fe7be379b,c50d814c-01d6-4ef3-8c4b-241662b6dc52

,389547c1-7453-4968-b8ce-7097f8d15315,32fa6a3b-d833-4261-80f8-8a2d5a3e5068,e256fd01-2fad-4651-a539-55fef01cfbca,27a47a1d-5739-43bc-93b3-89d32050db7a,.....] 

Query was:

select t0.id c0, t0.creator_id c1, t0.creator_name c2, t0.modifier_id c3, t0.modifier_name c4, t0.deleted c5, t0.name c6, t0.first_letter c7, t0.avatar c8, t0.s

ex c9, t0.login_password c10, t0.id_card c11, t0.birthday c12, t0.email c13, t0.mobile c14, t0.comp_phone c15, t0.fax c16, t0.address c17, t0.position c18, t0.p

ostcode c19, t0.email_checked c20, t0.email_check_info c21, t0.email_check_end c22, t0.mobile_checked c23, t0.mobile_check_info c24, t0.mobile_check_end c25, t0

.enabled c26, t0.registed c27, t0.memo c28, t0.create_time c29, t0.modify_time c30 from OK_USER t0 where t0.id in (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?

,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)  order by t0.first_letter, t0.name 


] with root cause

java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic@3ef4415f is still active. No statements may be issued when any streaming result sets a

re open and in use on a given connection. Ensure that you have called .close() on any active streaming result sets before attempting more queries.

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:924)

at com.mysql.jdbc.MysqlIO.checkForOutstandingStreamingData(MysqlIO.java:3361)

at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524)

at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778)

at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2825)

at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2156)

at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2323)

at com.avaje.ebeaninternal.server.lib.sql.ExtendedPreparedStatement.executeQuery(ExtendedPreparedStatement.java:132)

at com.avaje.ebeaninternal.server.query.CQuery.prepareBindExecuteQueryWithOption(CQuery.java:325)

at com.avaje.ebeaninternal.server.query.CQuery.prepareBindExecuteQuery(CQuery.java:274)

at com.avaje.ebeaninternal.server.query.CQueryEngine.findMany(CQueryEngine.java:165)

at com.avaje.ebeaninternal.server.query.DefaultOrmQueryEngine.findMany(DefaultOrmQueryEngine.java:80)

at com.avaje.ebeaninternal.server.core.OrmQueryRequest.findList(OrmQueryRequest.java:284)

at com.avaje.ebeaninternal.server.core.DefaultServer.findList(DefaultServer.java:1372)

at com.avaje.ebeaninternal.server.core.DefaultBeanLoader.loadBean(DefaultBeanLoader.java:335)

at com.avaje.ebeaninternal.server.core.DefaultServer.loadBean(DefaultServer.java:468)

at com.avaje.ebeaninternal.server.loadcontext.DLoadBeanContext.loadSecondaryQuery(DLoadBeanContext.java:94)

at com.avaje.ebeaninternal.server.loadcontext.DLoadContext.executeSecondaryQueries(DLoadContext.java:109)

at com.avaje.ebeaninternal.server.core.OrmQueryRequest.executeSecondaryQueries(OrmQueryRequest.java:82)

at com.avaje.ebeaninternal.server.query.CQueryIteratorWithBuffer.hasNext(CQueryIteratorWithBuffer.java:46)

at cn.anytech.enterprise.service.admin.UserManager.getEntVOUsers(UserManager.java:150)

at cn.anytech.enterprise.web.controller.ent.EntUserController.getEntUserList(EntUserController.java:64)

at sun.reflect.GeneratedMethodAccessor548.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Method.java:497)

at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)

at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)

at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)

at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:777)

at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:706)

at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)

at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)

at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:146)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)

at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)

at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)

at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at com.someok.common.base.web.servlet.PerformanceFilter.doFilterInternal(PerformanceFilter.java:73)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)

at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:122)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)

at org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:170)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)

at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:745)

Rob Bygrave

unread,
May 28, 2015, 8:23:34 AM5/28/15
to ebean@googlegroups
I have reproduced this issue (MySQL specific).  

I do have a 'fix' for it, should be able to get the fix into master tomorrow night.


Cheers, Rob.

Rob Bygrave

unread,
May 29, 2015, 5:14:48 AM5/29/15
to ebean@googlegroups
Logged as https://github.com/ebean-orm/avaje-ebeanorm/issues/301

Fixed in master now.


Cheers, Rob. 
Reply all
Reply to author
Forward
0 new messages