<< Back to previous view

[QB-2797] Error during calling ReST API: could not execute query
Created: 01/Sep/16  Updated: 01/Sep/16

Status: Closed
Project: QuickBuild
Component/s: None
Affects Version/s: 5.1.16
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Tomasz Sadowski Assigned To: Robin Shen
Resolution: Won't Fix Votes: 0
Remaining Estimate: Unknown Time Spent: Unknown
Original Estimate: Unknown
Environment: SUSE Linux Enterprise Server 11 (x86_64), Microsoft SQL server


 Description   
I call ReST API: .../rest/builds?configuration_id=1417&from_date=2016-09-01%2004:32:21&to_date=2016-09-01%2004:44:24&recursive=true&count=4000
and got http 500: could not execute query

Interesting thing is that this this issue happens for 1417 configuration only. For other configuration_id it works fine and return nice XML.
When recursive parameter is removed then ReST call works fine however does not return any rows because we not run any builds there but under child configurations.

QB logs are down below:
2016-09-01 05:15:32,794 [qtp794078184-177] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 22025
2016-09-01 05:15:32,794 [qtp794078184-177] ERROR org.hibernate.util.JDBCExceptionReporter - Prepared or callable statement has more than 2000 parameter markers.
2016-09-01 05:15:32,795 [qtp794078184-177] ERROR com.pmease.quickbuild.rest.providers.GenericExceptionMapper - Error serving restful request.
 org.hibernate.exception.DataException: could not execute query
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:102)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
        at org.hibernate.loader.Loader.doList(Loader.java:2536)
        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
        at org.hibernate.loader.Loader.list(Loader.java:2271)
        at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:119)
        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1716)
        at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)
        at com.pmease.quickbuild.entitymanager.impl.AbstractEntityManager.searchEntities(AbstractEntityManager.java:165)
        at com.pmease.quickbuild.persistence.SessionInterceptor.invoke(SessionInterceptor.java:116)
        at com.pmease.quickbuild.entitymanager.impl.AbstractEntityManager.search(AbstractEntityManager.java:110)
        at com.pmease.quickbuild.persistence.SessionInterceptor.invoke(SessionInterceptor.java:91)
        at com.pmease.quickbuild.rest.resources.BuildResource.query(BuildResource.java:91)
        at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:149)
        at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
        at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:259)
        at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:83)
        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133)
        at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:71)
        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:990)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:941)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:932)
        at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:384)
        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:451)
        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:632)
        at com.pmease.quickbuild.rest.RestServlet.service(RestServlet.java:48)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:669)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1336)
        at com.pmease.quickbuild.Quickbuild$DisableTraceFilter.doFilter(Quickbuild.java:1033)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:453)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:229)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
        at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
        at org.eclipse.jetty.server.Server.handle(Server.java:365)
        at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)
        at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)
        at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926)
        at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988)
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635)
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
        at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)
        at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
        at java.lang.Thread.run(Thread.java:744)
 Caused by: java.sql.SQLException: Prepared or callable statement has more than 2000 parameter markers.
        at net.sourceforge.jtds.jdbc.SQLParser.parse(SQLParser.java:1139)
        at net.sourceforge.jtds.jdbc.SQLParser.parse(SQLParser.java:156)
        at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.<init>(JtdsPreparedStatement.java:98)
        at net.sourceforge.jtds.jdbc.ConnectionJDBC2.prepareStatement(ConnectionJDBC2.java:2445)
        at net.sourceforge.jtds.jdbc.ConnectionJDBC2.prepareStatement(ConnectionJDBC2.java:2403)
        at com.mchange.v2.c3p0.impl.NewProxyConnection.prepareStatement(NewProxyConnection.java:213)
        at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
        at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
        at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
        at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1700)
        at org.hibernate.loader.Loader.doQuery(Loader.java:801)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
        at org.hibernate.loader.Loader.doList(Loader.java:2533)
        ... 52 more

Could you help with this one as we cannot pull any builds from this configuration.

Thanks in advance.


 Comments   
Comment by Robin Shen [ 01/Sep/16 10:29 PM ]
This is because that you have too many children in this configuration and you've specified the recursive flag for query, and this cause the sql to include each descendant configuration and eventually exceeds the sql parameter limit.

To solve this, you may need to perform query on subtree with less children.
Generated at Wed May 22 03:23:46 UTC 2024 using JIRA 189.