Skip to content

github-events.rb earliest() infinite loop on repos with very long commit history #1661

Description

@sdghsdkjlas27-dotcom

DESCRIPTION:
In github-events.rb's earliest() function (lines 112-120), the loop does:

while commits.size != 1
  commits = Fbe.octo.commits(repo, sha: last[:sha])
  last = commits.last
end

For a repo with a very long commit history (e.g. 100k+ commits), this fetches older pages of commits one at a time, potentially forever if commits always has size > 1 (e.g. >100 commits always returned). Each iteration consumes API quota. Also, if commits.last is nil (empty response edge case), last[:sha] raises NoMethodError.

REPRODUCTION:

  1. Process a repo with very long commit history.
  2. Watch the API quota burn; or
  3. Process an empty repo (commits is []); nil[:sha] raises.

IMPACT:
API quota exhaustion (GitHub secondary rate limit); or crash.

RELATED FILES:
judges/github-events/github-events.rb

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions