Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

GitHub Plugin API Request Rate Limiting #4242

uartie ·

Does the GitHub repository plugin use the "User Name" and "Password" settings to make "Authenticated" calls to the GitHub API? Or are those settings only used for the underlying git operations? According to https://developer.github.com/v3/#rate-limiting, unauthenticated API calls are limited to 60/hr. I'm trying to figure out if an occasional error we observe is caused by hitting that limit. Is there another way to ensure/configure GitHub API calls by QB are being authenticated? Authenticated calls allow 5000/hr rate limit.

Here is the occasional error we observe:

jvm 1    | java.lang.RuntimeException: Error executing checkout build finish job.
jvm 1    |      at com.pmease.quickbuild.repositorysupport.CheckoutBuildFinishTask.reduce(CheckoutBuildFinishTask.java:35)
jvm 1    |      at com.pmease.quickbuild.repositorysupport.CheckoutBuildFinishTask.reduce(CheckoutBuildFinishTask.java:24)
jvm 1    |      at com.pmease.quickbuild.grid.GridTaskFuture.get(GridTaskFuture.java:155)
jvm 1    |      at com.pmease.quickbuild.grid.GridTaskFuture.get(GridTaskFuture.java:159)
jvm 1    |      at com.pmease.quickbuild.DefaultBuildEngine.run(DefaultBuildEngine.java:679)
jvm 1    |      at com.pmease.quickbuild.DefaultBuildEngine.process(DefaultBuildEngine.java:464)
jvm 1    |      at com.pmease.quickbuild.DefaultBuildEngine.access$000(DefaultBuildEngine.java:144)
jvm 1    |      at com.pmease.quickbuild.DefaultBuildEngine$2.run(DefaultBuildEngine.java:1245)
jvm 1    |      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
jvm 1    |      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
jvm 1    |      at java.lang.Thread.run(Thread.java:748)
jvm 1    | Caused by: java.lang.RuntimeException: java.net.SocketException: Connection reset
jvm 1    |      at com.google.common.base.Throwables.propagate(Throwables.java:160)
jvm 1    |      at com.pmease.quickbuild.plugin.scm.github.GitHubRepository.buildFinished(GitHubRepository.java:119)
jvm 1    |      at com.pmease.quickbuild.plugin.scm.github.GitHubRepository$$EnhancerByCGLIB$$54ff6295.CGLIB$buildFinished$27(<generated>)
jvm 1    |      at com.pmease.quickbuild.plugin.scm.github.GitHubRepository$$EnhancerByCGLIB$$54ff6295$$FastClassByCGLIB$$e86bf23a.invoke(<generated>)
jvm 1    |      at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:215)
jvm 1    |      at com.pmease.quickbuild.DefaultScriptEngine$Interpolator.intercept(DefaultScriptEngine.java:261)
jvm 1    |      at com.pmease.quickbuild.plugin.scm.github.GitHubRepository$$EnhancerByCGLIB$$54ff6295.buildFinished(<generated>)
jvm 1    |      at com.pmease.quickbuild.repositorysupport.CheckoutBuildFinishJob.executeBuildAwareJob(CheckoutBuildFinishJob.java:38)
jvm 1    |      at com.pmease.quickbuild.BuildAwareJob.execute(BuildAwareJob.java:77)
jvm 1    |      at com.pmease.quickbuild.grid.GridJob.run(GridJob.java:129)
jvm 1    |      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
jvm 1    |      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
jvm 1    |      ... 3 more
jvm 1    | Caused by: java.net.SocketException: Connection reset
jvm 1    |      at java.net.SocketInputStream.read(SocketInputStream.java:210)
jvm 1    |      at java.net.SocketInputStream.read(SocketInputStream.java:141)
jvm 1    |      at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
jvm 1    |      at sun.security.ssl.InputRecord.read(InputRecord.java:503)
jvm 1    |      at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:975)
jvm 1    |      at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
jvm 1    |      at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1395)
jvm 1    |      at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1379)
jvm 1    |      at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
jvm 1    |      at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
jvm 1    |      at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1334)
jvm 1    |      at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1309)
jvm 1    |      at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:259)
jvm 1    |      at org.eclipse.egit.github.core.client.GitHubClient.sendParams(GitHubClient.java:645)
jvm 1    |      at org.eclipse.egit.github.core.client.GitHubClient.sendJson(GitHubClient.java:664)
jvm 1    |      at org.eclipse.egit.github.core.client.GitHubClient.post(GitHubClient.java:788)
jvm 1    |      at org.eclipse.egit.github.core.service.CommitService.createStatus(CommitService.java:428)
jvm 1    |      at com.pmease.quickbuild.plugin.scm.github.GitHubRepository.updateCommitStatus(GitHubRepository.java:205)
jvm 1    |      at com.pmease.quickbuild.plugin.scm.github.GitHubRepository.buildFinished(GitHubRepository.java:101)
jvm 1    |      ... 13 more
  • replies 7
  • views 1927
  • stars 1
steveluo ADMIN ·

Hi@uartie,

First, I need know whether you are using SSH to connect with GitHub or not.

QuickBuild uses username and password to do the repository operations like clone/pull/push, tag/label, update commit status, get pull requests, etc. But now GitHub is deprecating the password authentication, you need change it to personal access token, see details below:

If the username and password are filled in, QuickBuild will use them to do the authentication for API calls.

But from the error you mentioned, it's more likely the connection to GitHub is not stable, because if the rate limit is exceeded, the error should be 403 forbidden. Also, it seems that the repository pull/push operations are not included in the rate limit as they are not API calls.

If you want to limit the API calls, you can set Context Label to empty and then QuickBuild will not update the commit status to GitHub.

uartie ·

We are using the HTTPS URL in the "Fetch URL" field. Also, we are using a personal access token in the password field. Additionally, we use the "Context Label" so we can see the commit status in GitHub. Ideally, we'd like to continue to use the "Context Label" feature to see the status.

Is there a way to see logs for the API calls being made by QB?

uartie ·

...additionally, when I run curl -u <user>:<token> https://api.github.com/rate_limit from a command line, it shows about ~150/hr usage (i.e. 4850 remaining; limit: 5000). If I run the same curl command without -u <user>:<token> specified, it occasionally shows "remaining: 0" (limit: 60)... usually around the time we see the QB error. So this makes me wonder if there are some unauthenticated API calls from QB that slip through.

steveluo ADMIN ·

Hi@uartie,

Thanks for the information.

QuickBuild will use the username and password as long as you specified. So you may have to check whether the related GitHub settings, not only GitHub repository, but also GitHub issue tracker which is also using the GitHub APIs to fetch and update the issues.

Is there a way to see logs for the API calls being made by QB?

So far, there isn't any log to show. I will add some log to show the remaining requests number after triggering the GitHub API calls.

But from below log, the error is occurred when trying to update commit status, so, if the username and password are set for this repository, we can confirm that the authenticated quota is used here.

jvm 1    | Caused by: java.lang.RuntimeException: java.net.SocketException: Connection reset
jvm 1    |      at com.google.common.base.Throwables.propagate(Throwables.java:160)
jvm 1    |      at com.pmease.quickbuild.plugin.scm.github.GitHubRepository.buildFinished(GitHubRepository.java:119)
uartie ·

We don't use the GitHub issue tracker feature in QuickBuild. We only use the GitHub repository feature.

Since you've confirmed that QuickBuild will use authenticated GitHub API calls, our issue must not be related.

But from the error you mentioned, it's more likely the connection to GitHub is not stable...

Yes, perhaps we have an unstable connection to GitHub... we will investigate this as the possible cause.

I just realized I posted this question in the wrong forum... I apologize. Please move it to the QuickBuild forum, if possible.

Thanks for all your support!

#7
steveluo moved this topic
uartie ·

Yep, as you pointed out, it seems it was a unstable connection to GitHub. We have some agents located in different GEO's that are notorious for poor external network connections. After I forced all Git/GitHub repository checkout steps and Master step to agents in GEO with high-quality connections, I have not encountered any of these intermittent errors.

Thanks for all your help and clarification.