Loading
fix(rate_limit): raise regex match timeout to 50ms
The 5ms budget fired 9,511 times in the 24h after deploy and ~624/hour
since, all fail-open, all on git HTTP paths.
The matches themselves are not slow: against the 6935 real paths that
timed out, the median is 0.087ms and the worst 1.484ms, with none above
2ms. Ruby's regex timeout counts wall-clock time, so a match billed for a
GC pause exceeds the budget without doing regex work, and GC pauses on
GitLab.com's git fleet have a p50 of ~72ms.
50ms is 34x the slowest real path and still bounds catastrophic
backtracking. Under 4x CPU oversubscription it fires on 0.16% of the
corpus against 5ms's 1.33%, so it reduces the fail-opens roughly 8x
rather than eliminating them.
Also replaces the benchmark note above the constant, which cited a
measurement that never included repository_git_lfs_route_regex.
Refs gitlab-com/gl-infra/production-engineering#28882
Co-Authored-By:
Claude Opus 5 (1M context) <noreply@anthropic.com>