Skip to content

Conversation

@derek-miller
Copy link
Contributor

@derek-miller derek-miller commented Nov 1, 2025

When syncing generic-git-host connections with thousands of repositories, unbounded Promise.all caused resource exhaustion (EAGAIN errors) by spawning too many concurrent git processes. This resulted in valid repositories being incorrectly skipped during sync.

  • Add p-limit to control concurrent git operations (max 100)
  • Follow existing pattern from github.ts for consistency
  • Prevents file descriptor and process limit exhaustion
  • Uses rolling concurrency to avoid head-of-line blocking

Fixes #590

@coderabbitai
Copy link

coderabbitai bot commented Nov 1, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@derek-miller derek-miller changed the title fix(backend): Limit concurrent git operations to prevent resource exh… fix(backend): Limit concurrent git operations to prevent resource exhaustion Nov 1, 2025
brendan-kellam
brendan-kellam previously approved these changes Nov 1, 2025
Copy link
Contributor

@brendan-kellam brendan-kellam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm thanks

…austion (sourcebot-dev#590)

When syncing generic-git-host connections with thousands of repositories,
unbounded Promise.all caused resource exhaustion (EAGAIN errors) by spawning
too many concurrent git processes. This resulted in valid repositories being
incorrectly skipped during sync.

- Add p-limit to control concurrent git operations (max 100)
- Follow existing pattern from github.ts for consistency
- Prevents file descriptor and process limit exhaustion
- Uses rolling concurrency to avoid head-of-line blocking

Fixes sourcebot-dev#590
@derek-miller
Copy link
Contributor Author

@brendan-kellam Fixed the CI issue. Good to merge

@brendan-kellam brendan-kellam merged commit 2c0540f into sourcebot-dev:main Nov 1, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Promise.all resource exhaustion causes thousands of repos to be skipped during generic-git-host connection sync

3 participants