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

[BUG]: Octokit hangs when making 10 parallel requests. #2800

Open
1 task done
codiophile opened this issue Jan 31, 2025 · 9 comments
Open
1 task done

[BUG]: Octokit hangs when making 10 parallel requests. #2800

codiophile opened this issue Jan 31, 2025 · 9 comments
Labels
Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented

Comments

@codiophile
Copy link

What happened?

I have this polling logic that polls a list of repositories every 30 seconds to check if any of them are in need of a custom runner. It looks something like this:

await Promise.all(this.repos.map(async (repo) => {
  const response = await this.octokit.rest.actions.listWorkflowRunsForRepo({
    owner: repo.owner,
    repo: repo.repo,
    status: 'queued'
  });
  // The rest of the logic for spinning up custom runners isn't relevant, and it doesn't get this far anyway.
}));

When I have up to 9 repos in the list, everything works fine. When I add the 10th repo, they all hang on the octokit call. The response is never returned and no errors are thrown.

I could obviously make all these calls, one after another, to make it work, but it seems like a bug that there's an arbitrary limit of 10 and that it hangs, instead of throwing an error, or queueing the requests internally.

Versions

Octokit v4.0.2
Node v22.9.0

Relevant log output

No output at all. The calls never return, nor do they throw any errors.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@codiophile codiophile added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Jan 31, 2025
Copy link

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

@wolfy1339
Copy link
Member

It should be retrying and throttling things by default.

It uses the following under the hood
https://github.com/octokit/plugin-throttling.js/
https://github.com/octokit/plugin-retry.js/

@erik-lbg
Copy link

It should be retrying and throttling things by default.

It uses the following under the hood https://github.com/octokit/plugin-throttling.js/ https://github.com/octokit/plugin-retry.js/

I agree. It should. But that's not what's happening. It's just stuck.

@wolfy1339
Copy link
Member

The maximum concurrency is defined here: https://github.com/octokit/plugin-throttling.js/blob/main/src/index.ts#L30

@codiophile
Copy link
Author

The maximum concurrency is defined here: https://github.com/octokit/plugin-throttling.js/blob/main/src/index.ts#L30

Thanks. That's helpful. Unfortunately, that looks hardcoded. Do you know if there's a way to override it? Increasing it to 20 would solve the current issue, even though it's not the right solution. Ideally, it should work fine and simply queue the 10th request, but instead it hangs.

@wolfy1339
Copy link
Member

Unfortunately I don't see a way either.

These are supposed to be sensible defaults, and there has got to be a reason it's set to 10 concurrent connections.

Maybe @gr2m would have more insight as to why it is that way

@gr2m
Copy link
Contributor

gr2m commented Feb 3, 2025

We set the defaults to avoid secondary rate limiting (abuse rate limiting). The limits are not documented and are variable, so they are not a guarantee, but based on the experience over the past few years they are holding up pretty good. I agree these should be configurable for situations like yours though.

I suggest we open an issue on https://github.com/octokit/plugin-throttling.js and start a draft PR for further discussion. @codiophile would you like to send one?

Ping @nickfloyd @kfcampbell what do you think?

@codiophile
Copy link
Author

We set the defaults to avoid secondary rate limiting (abuse rate limiting). The limits are not documented and are variable, so they are not a guarantee, but based on the experience over the past few years they are holding up pretty good. I agree these should be configurable for situations like yours though.

Does this imply that this is actually intended behaviour? To me, not allowing more than 10 requests at a time seems fine, but I would expect it to queue the excess requests or at least throw an error, rather than just hang. The whole service hanging is really not useful.

I suggest we open an issue on https://github.com/octokit/plugin-throttling.js and start a draft PR for further discussion. @codiophile would you like to send one?

I don't mind, but I have no familiarity with the project. It might take me a while to put something together.

@gr2m
Copy link
Contributor

gr2m commented Feb 4, 2025

Does this imply that this is actually intended behaviour? To me, not allowing more than 10 requests at a time seems fine, but I would expect it to queue the excess requests or at least throw an error, rather than just hang.

Yes requests should be queued. If they are not it's a bug, it would be helpful to have a simple script to reliably reproduce the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented
Projects
Status: 🆕 Triage
Development

No branches or pull requests

4 participants