Skip to content

Conversation

@jacquesh
Copy link
Contributor

Bandwidth limits in haproxy are almost always stored or passed around as uints internally. The one exception to that is freq_ctr_overshoot_period, which calculates how far over the limit a freq_ctr has gone (producing the minimum amount of time that the user should wait before submitting more events). This result is returned currently as a signed integer. This is not inherently problematic, but it's a little strange (all other quantities are unsigned in those calculations, and they're all closely related) and also the conversion to a signed quantity happens implicitly right at the end, after a possible overflow of the unsigned intermediate value. The end result of this for us is that if you set a very high limit when using the freq_ctr-based bandwidth limiting, then in some cases you will be instructed to wait for a long time, causing transfers to stall.

Note that this does not affect us currently because the new bandwidth limiting code has been unhooked for now until we can get the time to properly investigate the stale connection issues and get it back in.

I've also submitted this patch to HAProxy itself so we'll see what they say. If they accept it then much like our earlier bugfixes this patch will go away in a future HAProxy upgrade.

Type of Change

  • Bugfix
  • New Feature
  • Breaking Change
  • Refactor
  • Documentation
  • Other (please describe)

…h limits

Bandwidth limits in haproxy are almost always stored or passed around as uints internally. The one exception to that is
freq_ctr_overshoot_period, which calculates how far over the limit a freq_ctr has gone (producing the minimum amount of
time that the user should wait before submitting more events). This result is returned currently as a signed integer.
This is not inherently problematic, but it's a little strange (all other quantities are unsigned in those calculations,
and they're all closely related) and also the conversion to a signed quantity happens implicitly right at the end,
after a possible overflow of the unsigned intermediate value.

The end result of this for us is that if you set a very high limit when using the freq_ctr-based bandwidth limiting,
then in some cases you will be instructed to wait for a long time, causing transfers to stall.
@jacquesh jacquesh requested a review from a team as a code owner November 13, 2025 10:08
Copy link
Contributor

@aokhovat aokhovat left a comment

Choose a reason for hiding this comment

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

lgtm

@jacquesh jacquesh merged commit 924f861 into bloomberg:main Nov 13, 2025
2 checks passed
@jacquesh jacquesh deleted the add-freq-ctr-overshoot-overflow-fix branch November 13, 2025 16:48
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.

2 participants