Skip to content

feat(insights): Add fixed limits to concurrent report and source processing when uploading #179

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

Merged
merged 3 commits into from
Jul 24, 2025

Conversation

hk21702
Copy link
Collaborator

@hk21702 hk21702 commented Jul 24, 2025

Add fixed limits to concurrent report and source processing when uploading.

Presently, the theoretical infinite number of goroutines can be spawned when the client is processing and uploading reports. Where r is the number of reports across all targeted sources and s is the number of targeted sources, there is a maximum limit of r+s goroutines that may be spawned, with r routines potentially attempting to send out HTTP requests.

There is a 150 report limit per source on how many reports are allowed to be on the disk. Typically, a collection call will remove old reports if there are too many already on the disk, limiting the impact of the go routine spawns. But it is possible for abuse to result in a considerable number of sources and reports that the uploader will treat as valid. Should the HTTP requests block or be stuck in retry loops, this can be problematic.

This PR also includes a test to ensure that the limits are being respected.

There is also a small fix to ensure that the root directory isn't being processed when traversing a directory to search for reports. This change doesn't cause any behavioral changes other than preventing a bit of unnecessary log spam.


UDENG-7470

@hk21702 hk21702 self-assigned this Jul 24, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jul 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.47%. Comparing base (04a7f87) to head (bc9d892).

Additional details and impacted files
@@                 Coverage Diff                 @@
##           buildtime-tests     #179      +/-   ##
===================================================
- Coverage            87.52%   87.47%   -0.05%     
===================================================
  Files                   50       50              
  Lines                 4311     4326      +15     
===================================================
+ Hits                  3773     3784      +11     
- Misses                 408      411       +3     
- Partials               130      131       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@CarlosNihelton CarlosNihelton left a comment

Choose a reason for hiding this comment

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

I think we can improve resource consumption here.

@hk21702 hk21702 force-pushed the limit-goroutines branch from 91b2c13 to bc9d892 Compare July 24, 2025 21:17
Copy link
Contributor

@CarlosNihelton CarlosNihelton 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 for addressing yet this theoretical issue.

Base automatically changed from buildtime-tests to main July 24, 2025 21:41
@hk21702 hk21702 merged commit f0bec2c into main Jul 24, 2025
34 checks passed
@hk21702 hk21702 deleted the limit-goroutines branch July 24, 2025 21:41
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.

3 participants