Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default api/json?depth=1 cause timeout #220

Closed
suchasplus opened this issue Dec 27, 2016 · 3 comments
Closed

default api/json?depth=1 cause timeout #220

suchasplus opened this issue Dec 27, 2016 · 3 comments

Comments

@suchasplus
Copy link

due to jenkins api desc:

Another way to retrieve more data is to use the depth=N query parameter . This retrieves all the data up to the specified depth. Compare depth=0 and depth=1 and see what the difference is for yourself. Also note that data created by a smaller depth value is always a subset of the data created by a bigger depth value.

Because of the size of the data, the depth parameter should really be only used to explore what data Jenkins can return. Once you identify the data you want to retrieve, you can then come up with the tree parameter to exactly specify the data you need.

in a product env, jenkins always has many jobs/builds. and i always got a 504 Gateway Timeout when retrieve $domain/jenkins/api/json/?depth=1 behind nginx in online jenkins env ( 40+ jobs, 10000+ builds)
Should we disable depth=1 by default ?

@khmarbaise
Copy link
Member

First how do you call the Java Client API ? Can you show the code you are using? Furthermore which version of Jenkins are you using? and which version of the Java Client API you are using?

@suchasplus
Copy link
Author

Jenkins ver. 2.19.4
Java-Client-API ver 0.3.7

        jksSrv = new JenkinsServer(new URI(BASE_URL), USER, TOKEN);

        StringBuffer sb = new StringBuffer(4096);

        jksSrv.getViews().forEach((viewName, view) -> {

        sb.append(viewName).append(" ")

                .append(" url : ")

                .append(view.getUrl()) ;

       });

I got Gateway timeout

2016-12-30 18:02:11.692 ERROR 33505 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception

org.apache.http.client.HttpResponseException: Gateway Time-out
at com.offbytwo.jenkins.client.validator.HttpResponseValidator.validateResponse(HttpResponseValidator.java:11) ~[classes/:na]
at com.offbytwo.jenkins.client.JenkinsHttpClient.get(JenkinsHttpClient.java:139) ~[classes/:na]
at com.offbytwo.jenkins.JenkinsServer.getViews(JenkinsServer.java:191) ~[classes/:na]
at com.offbytwo.jenkins.JenkinsServer.getViews(JenkinsServer.java:179) ~[classes/:na]
at com.weibo.ad.JenkinsTest.getTest(JenkinsTest.java:46) ~[classes/:na]

@khmarbaise
Copy link
Member

It looks like the depth=1 is not necessary and does not makes sense in this relationship.

khmarbaise added a commit that referenced this issue Feb 3, 2017
     o getViews() default api/json?depth=1 cause timeout
       but that change has caused in a failing integration
       test case which is now fixed by using tree=.. parameters.
Veske pushed a commit to Veske/java-client-api that referenced this issue Feb 3, 2017
     o getViews() default api/json?depth=1 cause timeout
       but that change has caused in a failing integration
       test case which is now fixed by using tree=.. parameters.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants