Skip to content

Conversation

@pdolif
Copy link
Contributor

@pdolif pdolif commented Sep 15, 2025

Fixes #24694

Motivation

When the MemoryLimitController calculates the memory usage percentage, a division by 0 happens in case the memory limit is set to 0 / disabled. The current behaviour is that the percentage then is NaN.

Modifications

This PR changes the behaviour so that the percentage is always 0 in case the memory limit is 0.

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

  • MemoryLimitControllerTest now covers the case when the memory limit is set to 0.
  • Added receiver queue size auto-scale test that uses a client with memory limit being disabled.

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: pdolif#14

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Sep 15, 2025
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

LGTM, good work @pdolif

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.20%. Comparing base (0a949de) to head (71845c4).
⚠️ Report is 21 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #24743      +/-   ##
============================================
- Coverage     74.29%   74.20%   -0.10%     
- Complexity    33140    33603     +463     
============================================
  Files          1895     1900       +5     
  Lines        147979   148403     +424     
  Branches      17137    17206      +69     
============================================
+ Hits         109942   110119     +177     
- Misses        29317    29495     +178     
- Partials       8720     8789      +69     
Flag Coverage Δ
inttests 26.23% <0.00%> (-0.35%) ⬇️
systests 22.76% <0.00%> (-0.07%) ⬇️
unittests 73.71% <100.00%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ache/pulsar/client/impl/MemoryLimitController.java 94.02% <100.00%> (+0.18%) ⬆️

... and 126 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@Shawyeok Shawyeok left a comment

Choose a reason for hiding this comment

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

LGTM

@lhotari lhotari added this to the 4.2.0 milestone Sep 16, 2025
@lhotari lhotari added the type/bug The PR fixed a bug or issue reported a bug label Sep 16, 2025
@lhotari lhotari merged commit 8e35e34 into apache:master Sep 16, 2025
55 checks passed
lhotari pushed a commit that referenced this pull request Sep 16, 2025
lhotari pushed a commit that referenced this pull request Sep 16, 2025
lhotari pushed a commit that referenced this pull request Sep 16, 2025
lhotari pushed a commit that referenced this pull request Sep 16, 2025
nodece pushed a commit to ascentstream/pulsar that referenced this pull request Sep 16, 2025
ganesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Sep 18, 2025
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Sep 18, 2025
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request Sep 19, 2025
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Sep 19, 2025
KannarFr pushed a commit to CleverCloud/pulsar that referenced this pull request Sep 22, 2025
walkinggo pushed a commit to walkinggo/pulsar that referenced this pull request Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] autoScaledReceiverQueueSizeEnabled is at least broken in PerformanceConsumer (pulsar-perf consume -aq)

4 participants