-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
github-api:1.318
github-branch-source:1807.v50351eb_7dd13
Despite selecting the NoThrottle rate limit checker, the /rate_limit endpoint is still being hit in various scenario.
- Connector$GitHubConnection.verifyConnection is eventually calling org.kohsuke.github.GitHubClient.checkApiUrlValidity with NoThrottle but it does not matter because the GitHubClient has a GitHubRateLimitChecker that will only always skip the rate limits check if the RateLimitChecker provided is of type org.kohsuke.github.RateLimitChecker.NONE. If it is another type, the client will occasionally hit the rate limit endpoint...:
2024-12-20 00:56:53.183+0000 [id=72] FINE org.kohsuke.github.GitHubClient#lambda$getRateLimit$6: New Request to /rate_limit java.lang.Throwable at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.lambda$getRateLimit$6(GitHubClient.java:288) at PluginClassLoader for github-api//org.kohsuke.github.GitHubSanityCachedValue.get(GitHubSanityCachedValue.java:44) at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.getRateLimit(GitHubClient.java:283) at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.rateLimit(GitHubClient.java:353) at PluginClassLoader for github-api//org.kohsuke.github.GitHubRateLimitChecker.checkRateLimit(GitHubRateLimitChecker.java:140) at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:461) at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.fetch(GitHubClient.java:159) at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.checkApiUrlValidity(GitHubClient.java:391) at PluginClassLoader for github-api//org.kohsuke.github.GitHub.checkApiUrlValidity(GitHub.java:1321) at PluginClassLoader for github-branch-source//org.jenkinsci.plugins.github_branch_source.ApiRateLimitChecker.verifyConnection(ApiRateLimitChecker.java:194) at PluginClassLoader for github-branch-source//org.jenkinsci.plugins.github_branch_source.Connector$GitHubConnection.verifyConnection(Connector.java:722) at PluginClassLoader for github-branch-source//org.jenkinsci.plugins.github_branch_source.Connector.connect(Connector.java:419) at PluginClassLoader for github-branch-source//org.jenkinsci.plugins.github_branch_source.GitHubSCMSource$DescriptorImpl.doValidateRepositoryUrlAndCredentials(GitHubSCMSource.java:2143) at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732) at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:484) at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:497) at org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.java:79) org.kohsuke.github.GitHubClient.isCredentialValid (often used for form validation)
- org.kohsuke.github.GitHubClient.isCredentialValid (often used for form validation):
2024-12-20 00:56:54.919+0000 [id=72] FINE org.kohsuke.github.GitHubClient#lambda$getRateLimit$6: New Request to /rate_limit java.lang.Throwable at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.lambda$getRateLimit$6(GitHubClient.java:288) at PluginClassLoader for github-api//org.kohsuke.github.GitHubSanityCachedValue.get(GitHubSanityCachedValue.java:44) at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.getRateLimit(GitHubClient.java:283) at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.getRateLimit(GitHubClient.java:255) at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.lambda$isCredentialValid$2(GitHubClient.java:172) at PluginClassLoader for github-api//org.kohsuke.github.GitHubSanityCachedValue.get(GitHubSanityCachedValue.java:44) at PluginClassLoader for github-api//org.kohsuke.github.GitHubSanityCachedValue.get(GitHubSanityCachedValue.java:27) at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.isCredentialValid(GitHubClient.java:168) at PluginClassLoader for github-api//org.kohsuke.github.GitHub.isCredentialValid(GitHub.java:1246) at PluginClassLoader for github-branch-source//org.jenkinsci.plugins.github_branch_source.GitHubSCMSource$DescriptorImpl.doValidateRepositoryUrlAndCredentials(GitHubSCMSource.java:2145) at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732) at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:484) at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:497) at org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.java:79) at org.kohsuke.stapler.PreInvokeInterceptedFunction.invoke(PreInvokeInterceptedFunction.java:26) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:218) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:140) 2024-12-20 01:02:20.017+0000 [id=72] FINE org.kohsuke.github.GitHubClient#lambda$getRateLimit$6: New Request to /rate_limit java.lang.Throwable at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.lambda$getRateLimit$6(GitHubClient.java:288) at PluginClassLoader for github-api//org.kohsuke.github.GitHubSanityCachedValue.get(GitHubSanityCachedValue.java:44) at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.getRateLimit(GitHubClient.java:283) at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.getRateLimit(GitHubClient.java:255) at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.lambda$isCredentialValid$2(GitHubClient.java:172) at PluginClassLoader for github-api//org.kohsuke.github.GitHubSanityCachedValue.get(GitHubSanityCachedValue.java:44) at PluginClassLoader for github-api//org.kohsuke.github.GitHubSanityCachedValue.get(GitHubSanityCachedValue.java:27) at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.isCredentialValid(GitHubClient.java:168) at PluginClassLoader for github-api//org.kohsuke.github.GitHub.isCredentialValid(GitHub.java:1246) at PluginClassLoader for github//org.jenkinsci.plugins.github.config.GitHubServerConfig$DescriptorImpl.doVerifyCredentials(GitHubServerConfig.java:385) at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732) at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:484) at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:497) at org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.java:79) at org.kohsuke.stapler.PreInvokeInterceptedFunction.invoke(PreInvokeInterceptedFunction.java:26) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:218) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:140)
- Explicit calls to org.kohsuke.github.GitHubClient.getRateLimit():
2024-12-20 01:02:20.512+0000 [id=72] FINE org.kohsuke.github.GitHubClient#lambda$getRateLimit$6: New Request to /rate_limit java.lang.Throwable at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.lambda$getRateLimit$6(GitHubClient.java:288) at PluginClassLoader for github-api//org.kohsuke.github.GitHubSanityCachedValue.get(GitHubSanityCachedValue.java:44) at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.getRateLimit(GitHubClient.java:283) at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.getRateLimit(GitHubClient.java:255) at PluginClassLoader for github-api//org.kohsuke.github.GitHub.getRateLimit(GitHub.java:534) at PluginClassLoader for github//org.jenkinsci.plugins.github.config.GitHubServerConfig$DescriptorImpl.doVerifyCredentials(GitHubServerConfig.java:387) at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732) at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:484) at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:497) at org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.java:79) at org.kohsuke.stapler.PreInvokeInterceptedFunction.invoke(PreInvokeInterceptedFunction.java:26) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:218) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:140) at org.kohsuke.stapler.MetaClass$12.doDispatch(MetaClass.java:686) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:61) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:800) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:938) 2024-12-20 01:10:00.412+0000 [id=291] FINE org.kohsuke.github.GitHubClient#lambda$getRateLimit$6: New Request to /rate_limit java.lang.Throwable at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.lambda$getRateLimit$6(GitHubClient.java:288) at PluginClassLoader for github-api//org.kohsuke.github.GitHubSanityCachedValue.get(GitHubSanityCachedValue.java:44) at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.getRateLimit(GitHubClient.java:283) at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.getRateLimit(GitHubClient.java:255) at PluginClassLoader for github-api//org.kohsuke.github.GitHub.getRateLimit(GitHub.java:534) at PluginClassLoader for github-branch-source//org.jenkinsci.plugins.github_branch_source.Connector.checkScanCredentials(Connector.java:218) at PluginClassLoader for github-branch-source//org.jenkinsci.plugins.github_branch_source.GitHubSCMNavigator$DescriptorImpl.doCheckCredentialsId(GitHubSCMNavigator.java:1776) at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732) at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:484) at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:497) at org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.java:79) at org.kohsuke.stapler.PreInvokeInterceptedFunction.invoke(PreInvokeInterceptedFunction.java:26) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:218) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:140) at org.kohsuke.stapler.MetaClass$12.doDispatch(MetaClass.java:686) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:61) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:800) 2024-12-20 01:39:49.432+0000 [id=110] FINE org.kohsuke.github.GitHubClient#lambda$getRateLimit$6: New Request to /rate_limit java.lang.Throwable at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.lambda$getRateLimit$6(GitHubClient.java:288) at PluginClassLoader for github-api//org.kohsuke.github.GitHubSanityCachedValue.get(GitHubSanityCachedValue.java:44) at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.getRateLimit(GitHubClient.java:283) at PluginClassLoader for github-api//org.kohsuke.github.GitHubClient.getRateLimit(GitHubClient.java:255) at PluginClassLoader for github-api//org.kohsuke.github.GitHub.getRateLimit(GitHub.java:534) at PluginClassLoader for github-branch-source//org.jenkinsci.plugins.github_branch_source.GitHubAppCredentials$DescriptorImpl.doTestConnection(GitHubAppCredentials.java:726) at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732) at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:484) at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:497) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:218) at org.kohsuke.stapler.SelectionInterceptedFunction$Adapter.invoke(SelectionInterceptedFunction.java:37) at org.kohsuke.stapler.verb.HttpVerbInterceptor.invoke(HttpVerbInterceptor.java:48) at org.kohsuke.stapler.SelectionInterceptedFunction.bindAndInvoke(SelectionInterceptedFunction.java:26) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:140) at org.kohsuke.stapler.MetaClass$12.doDispatch(MetaClass.java:686) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:61) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:800) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:938) at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:369) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:61)
****
Some of this can be fixed in GH Branch Source:
Explicit calls to getRateLimit() should not be done if Rate Limit checker NoThrottle is selected:
- https://github.com/jenkinsci/github-branch-source-plugin/blob/1807.v50351eb_7dd13/src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubAppCredentials.java#L723-L729
- https://github.com/jenkinsci/github-branch-source-plugin/blob/1807.v50351eb_7dd13/src/main/java/org/jenkinsci/plugins/github_branch_source/Connector.java#L218
Calls to GitHubClient.isCredentialsValid should not be done directly and should have a check for the checker configuration. Connector.isCredentialsValid(GitHub) should be used:
- github-branch-source-plugin/src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource.java at 1807.v50351eb_7dd13 ยท jenkinsci/github-branch-source-plugin
- Maybe github-api could use a different endpoint to check that a credentials is valid ? https://github.com/hub4j/github-api/blob/github-api-1.318/src/main/java/org/kohsuke/github/GitHubClient.java#L170-L172.
For general request send, the problem is that the checker set for the GitHubClient is a org.jenkinsci.plugins.github_branch_source.ApiRateLimitChecker.RateLimitCheckerAdapter to be able to dynamically configure the client in case the configuration has changed. But the only way to really not check the rate limit at the moment is to use an instance of RateLimitChecker.NONE from the GitHub API:
- links to