Skip to content

[HF 9.3.13] CLDSRV-979: rate limit pinned request logger - #6263

Open
tmacro wants to merge 5 commits into
hotfix/9.3.13from
bugfix/CLDSRV-979-rate-limit-pinned-request-logger_bp_9_3_13
Open

[HF 9.3.13] CLDSRV-979: rate limit pinned request logger#6263
tmacro wants to merge 5 commits into
hotfix/9.3.13from
bugfix/CLDSRV-979-rate-limit-pinned-request-logger_bp_9_3_13

Conversation

@tmacro

@tmacro tmacro commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

No description provided.

anurag4DSB and others added 3 commits August 21, 2026 11:04
WorkerTokenBucket stored the werelogs logger of the first request that
touched a resource, and the 100ms refill job then logged through it for
the lifetime of the process. RequestLogger buffers every entry it is
handed in RequestLogger.entries and only drains when something logs at
or above the dump threshold ('error'), so the refill chatter accumulated
forever - about 80MB per account per connector on a 10-worker deployment,
reclaimed only by restarting cloudserver. S3C runs at logLevel info, so
the buffered debug/trace lines were never even printed.

The logger is now supplied per call to refillIfNeeded() and never stored.
The refill job passes the long-lived server logger, which writes through
and drops sub-level entries instead of buffering them.

The existing tests could not have caught this: they all pass a sinon
stub as the logger, so the werelogs buffering that is the bug is never
exercised. The new retention tests assert the invariants directly - no
retained request logger, and refills logged through the caller's logger.

(cherry picked from commit 3c9879b)
The unit environment has no rate limit Redis instance (the feature is
disabled at Config load), so every refill test bounced off isReady()
into the catch block and the grant, denial, disconnected and slow paths
were never executed - codecov flagged exactly those lines.

tokenBucket now reads rateLimitClient.instance at call time instead of
destructuring it at module load, which is behaviour-identical in
production (the instance is created once, before the first request) and
lets tests substitute a fake client. Five new cases cover each outcome;
tokenBucket.js line coverage goes from 83% to 98%, leaving only the
defensive requested <= 0 guard, unreachable while refillThreshold is
below bufferSize.

(cherry picked from commit 04359d0)
@bert-e

bert-e commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Hello tmacro,

My role is to assist you with the merge of this
pull request. Please type @bert-e help to get information
on this process, or consult the user documentation.

Available options
name description privileged authored
/after_pull_request Wait for the given pull request id to be merged before continuing with the current one.
/bypass_author_approval Bypass the pull request author's approval
/bypass_build_status Bypass the build and test status
/bypass_commit_size Bypass the check on the size of the changeset TBA
/bypass_incompatible_branch Bypass the check on the source branch prefix
/bypass_jira_check Bypass the Jira issue check
/bypass_peer_approval Bypass the pull request peers' approval
/bypass_leader_approval Bypass the pull request leaders' approval
/approve Instruct Bert-E that the author has approved the pull request. ✍️
/create_pull_requests Allow the creation of integration pull requests.
/create_integration_branches Allow the creation of integration branches.
/no_octopus Prevent Wall-E from doing any octopus merge and use multiple consecutive merge instead
/unanimity Change review acceptance criteria from one reviewer at least to all reviewers
/wait Instruct Bert-E not to run until further notice.
Available commands
name description privileged
/help Print Bert-E's manual in the pull request.
/status Print Bert-E's current status in the pull request.
/clear Remove all comments from Bert-E from the history TBA
/retry Re-start a fresh build TBA
/build Re-start a fresh build TBA
/force_reset Delete integration branches & pull requests, and restart merge process from the beginning.
/reset Try to remove integration branches unless there are commits on them which do not appear on the source branch.

Status report is not available.

@scality scality deleted a comment from bert-e Aug 21, 2026
@bert-e

bert-e commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • 2 peers

@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
8498 2 8496 0
View the top 1 failed test(s) by shortest run time
"after each" hook for "should fail if trying to overwrite a delete marker"::MPU with x-scal-s3-version-id header With v4 signature "after each" hook for "should fail if trying to overwrite a delete marker"
Stack Traces | 0.016s run time
We encountered an internal error. Please try again.
View the full list of 1 ❄️ flaky test(s)
"after each" hook for "should fail if trying to overwrite a delete marker"::MPU with x-scal-s3-version-id header With default signature "after each" hook for "should fail if trying to overwrite a delete marker"

Flake rate in main: 90.12% (Passed 24 times, Failed 219 times)

Stack Traces | 0.02s run time
We encountered an internal error. Please try again.

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@tmacro
tmacro force-pushed the bugfix/CLDSRV-979-rate-limit-pinned-request-logger_bp_9_3_13 branch from 8d04831 to 2b3069b Compare August 21, 2026 18:59
Comment on lines +37 to +44
const promise = bucket
.refillIfNeeded(logger)
.then(bucketRefilled => {
// Check if refill actually happened
if (bucketRefilled) {
refilled++;
}
})
@tmacro

tmacro commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

/approve

@bert-e

bert-e commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • 2 peers

The following options are set: approve

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.

5 participants