Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-62157

GitHub Enterprise rate limiting no longer working

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      The changes in JENKINS-59039 have broken rate limiting on our GitHub Enterprise instance.

      This GHE instance does not return rate limit information via the /rate_limit endpoint

      {
        "message": "Rate limiting is not enabled.",
        "documentation_url": "https://developer.github.com/enterprise/2.19/v3/rate_limit/#get-your-current-rate-limit-status"
      }
      

      but does return X-RateLimit headers on every request:

      < X-RateLimit-Limit: 5000
      < X-RateLimit-Reset: 1588603124
      < X-RateLimit-Remaining: 4999
      

      Before JENKINS-59039, it looks like the code called org.kohsuke.github.GitHub#rateLimit, which will return header-based rate limit info if it exists. Now the code calls org.kohsuke.github.GitHub#getRateLimit, which exclusively uses the /rate_limit endpoint.

      The end result is that the plugin does not throttle itself during organization/repository scanning and for repositories with large numbers of branches, the scan ends up failing when the rate limit is exceeded.

      Unfortunately I don't think modifying the response of the /rate_limit endpoint is an option. Any chance the plugin can be modified to call org.kohsuke.github.GitHub#rateLimit like it used to?

        Attachments

          Activity

          Hide
          bitwiseman Liam Newman added a comment -

          The problem is that org.kohsuke.github.GitHub#rateLimit may be stale and then throttling still doesn't work.

          The correct solution is to update getRateLimit() to handle this case, specifically to use the header rate limit information if it is present even on a 404 of the /ratelimit endpoint. Please file an issue with the github-api project - https://github.com/github-api/github-api

          Show
          bitwiseman Liam Newman added a comment - The problem is that org.kohsuke.github.GitHub#rateLimit may be stale and then throttling still doesn't work. The correct solution is to update getRateLimit() to handle this case, specifically to use the header rate limit information if it is present even on a 404 of the /ratelimit endpoint. Please file an issue with the github-api project - https://github.com/github-api/github-api
          Hide
          bfarrell Brian Farrell added a comment -
          Show
          bfarrell Brian Farrell added a comment - Thanks- I created  https://github.com/github-api/github-api/issues/802
          Hide
          bitwiseman Liam Newman added a comment -

          Fixed in github-api v1.112

          Show
          bitwiseman Liam Newman added a comment - Fixed in github-api v1.112

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            bfarrell Brian Farrell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: