Skip to content

Fix DEFAULT quota leak on undefined-type release (#3192) - #3193

Merged
junkaixue merged 1 commit into
apache:masterfrom
PrithMDP:fix-release-unknown-quota-type
Oct 20, 2026
Merged

junkaixue merged 1 commit into
apache:masterfrom
PrithMDP:fix-release-unknown-quota-type

Conversation

@PrithMDP

@PrithMDP PrithMDP commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Issues

  • My PR addresses the following Helix issues and references them in the PR description:

Fixes #3192

Description

  • Here are some details about my PR, including screenshots of any UI changes:

AssignableInstanceManager.release() only returned quota to _globalThreadBasedQuotaMap when the raw quota type was configured. For a task whose job type is not in the quota config, tryAssign() schedules it as DEFAULT, so assign() decrements the global DEFAULT quota. On release, the raw (undefined) type was not in the map, so nothing was added back. Each such task permanently leaked 1 from global DEFAULT. Eventually hasGlobalCapacity("DEFAULT") returned false, blocking scheduling of DEFAULT and unknown-type jobs until global capacity was recomputed (instance/config change or controller restart).

Fix: release() now treats a null or unconfigured quota type as DEFAULT, mirroring tryAssign(). Per-instance usage in AssignableInstance was already symmetric and is unchanged.

Tests

  • The following tests are written for this issue:

TestAssignableInstanceManagerQuotaRelease

  • testReleaseUndefinedQuotaTypeRestoresGlobalDefault

  • testReleaseNullQuotaTypeRestoresGlobalDefault

  • testReleaseRemovedQuotaTypeDoesNotInflateDefault

  • The following is the result of the "mvn test" command on the appropriate module:
    $ mvn -pl helix-core test -Dtest=TestAssignableInstanceManagerQuotaRelease
    [INFO] -------------------------------------------------------
    [INFO] T E S T S
    [INFO] -------------------------------------------------------
    [INFO] Running org.apache.helix.task.TestAssignableInstanceManagerQuotaRelease
    [INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.412 s - in org.apache.helix.task.TestAssignableInstanceManagerQuotaRelease
    [INFO]
    [INFO] Results:
    [INFO]
    [INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
    [INFO]
    [INFO] BUILD SUCCESS
    [INFO] Total time: 14.8 s

Changes that Break Backward Compatibility (Optional)

None.

Commits

  • My commits all reference appropriate Apache Helix GitHub issues in their subject lines.

Code Quality

  • My diff has been formatted using helix-style.xml

@PrithMDP PrithMDP changed the title Fix global DEFAULT quota leak when releasing tasks with an undefined … Fixes #3192 Fix global DEFAULT quota leak when releasing tasks with an undefined … Oct 14, 2026
@PrithMDP
PrithMDP force-pushed the fix-release-unknown-quota-type branch from bfc462f to 687a97c Compare October 14, 2026 02:59
@PrithMDP

PrithMDP commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor Author

@narendly @junkaixue can you PTAL? Please let me know if something needs adjusting.

@PrithMDP
PrithMDP force-pushed the fix-release-unknown-quota-type branch from 687a97c to cc5cc0a Compare October 14, 2026 04:52
Comment thread helix-core/src/main/java/org/apache/helix/task/AssignableInstanceManager.java Outdated
@PrithMDP
PrithMDP force-pushed the fix-release-unknown-quota-type branch from cc5cc0a to e558bc3 Compare October 15, 2026 19:44
@PrithMDP
PrithMDP requested a review from junkaixue October 15, 2026 19:49

@junkaixue junkaixue left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm. thanks for contributing this.

@PrithMDP PrithMDP changed the title Fixes #3192 Fix global DEFAULT quota leak when releasing tasks with an undefined … Fix global DEFAULT quota leak when releasing tasks with an undefined (#3192) Oct 20, 2026
@PrithMDP PrithMDP changed the title Fix global DEFAULT quota leak when releasing tasks with an undefined (#3192) Fix DEFAULT quota leak on undefined-type release (#3192) Oct 20, 2026
@PrithMDP

Copy link
Copy Markdown
Contributor Author

This PR is ready to be merged

Final commit message:

Fix global DEFAULT quota leak on release (#3192)

release() returned global quota only when the raw quota type was
configured. Tasks with a null or undefined quota type are scheduled
as DEFAULT, so assign() deducted from global DEFAULT but release()
never restored it. Each such task leaked one unit until global
capacity was recomputed, eventually blocking DEFAULT scheduling.

Return the quota to the type that was actually deducted, and do not
inflate DEFAULT when a quota type was removed while its task ran.

@junkaixue

@PrithMDP
PrithMDP force-pushed the fix-release-unknown-quota-type branch from e558bc3 to 1bed665 Compare October 20, 2026 22:47
release() returned global quota only when the raw quota type was
configured. Tasks with a null or undefined quota type are scheduled
as DEFAULT, so assign() deducted from global DEFAULT but release()
never restored it. Each such task leaked one unit until global
capacity was recomputed, eventually blocking DEFAULT scheduling.

Return the quota to the type that was actually deducted, and do not
inflate DEFAULT when a quota type was removed while its task ran.
@PrithMDP
PrithMDP force-pushed the fix-release-unknown-quota-type branch from 1bed665 to b2c18fd Compare October 20, 2026 22:49
@junkaixue
junkaixue merged commit 82fc756 into apache:master Oct 20, 2026
1 check passed
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.

AssignableInstanceManager.release() leaks global DEFAULT quota for tasks with an unknown job type

2 participants