Skip to content

[hotfix][Optimizer] Remove zero-valued in-flight task counters - #4328

Open
czy006 wants to merge 1 commit into
apache:masterfrom
czy006:codex/hotfix-optimizer-inflight-counter-cleanup
Open

[hotfix][Optimizer] Remove zero-valued in-flight task counters#4328
czy006 wants to merge 1 commit into
apache:masterfrom
czy006:codex/hotfix-optimizer-inflight-counter-cleanup

Conversation

@czy006

@czy006 czy006 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Brief change log

Remove the per-table in-flight task-counter entry when its count returns to zero, while preserving counters for active tasks. This prevents the counter map from retaining completed-table entries indefinitely.

How was this patch tested?

  • Add queue test coverage that verifies counter removal after task completion.
  • Add screenshots for manual tests if appropriate (not applicable: backend-only change).
  • Run TestOptimizingQueue#testInFlightCounterEntryRemovedAfterTaskCompletes locally with JDK 11 before creating this pull request.

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • no
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
  • not applicable

@czy006
czy006 marked this pull request as ready for review August 17, 2026 09:13
@github-actions github-actions Bot added the module:ams-server Ams server module label Aug 17, 2026
optimizingTasksMap kept a zero-count AtomicInteger entry forever after
a table's last task completed: poll created entries via
computeIfAbsent, acceptResult decremented but always returned the
holder, and neither releaseTable nor dispose cleaned up. Every table
that ever had a polled task (including deleted tables and tables that
moved groups) permanently occupied one map slot.

Switch acceptResult to an atomic compute that removes the entry at zero
(keeping the >0 decrement guard; late accepts on a removed entry are
no-ops instead of resurrecting it), and clear the entry in
releaseTable/dispose.

Regression test testTasksMapEntryRemovedAfterTaskCompletes (red before:
map size stayed 1). Full TestOptimizingQueue 47/47 green.
Fix record: docs/fix-records/2026-08-16-fix-19-optimizing-tasks-map-leak.md
@czy006
czy006 force-pushed the codex/hotfix-optimizer-inflight-counter-cleanup branch from cd3d1df to 8cf614a Compare August 18, 2026 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:ams-server Ams server module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant