Skip to content

Eagerly release resources in TransportAwaitClusterStateVersionAppliedAction#143477

Merged
DaveCTurner merged 3 commits intoelastic:mainfrom
DaveCTurner:2026/03/03/TransportAwaitClusterStateVersionAppliedAction-cancellation
Mar 3, 2026
Merged

Eagerly release resources in TransportAwaitClusterStateVersionAppliedAction#143477
DaveCTurner merged 3 commits intoelastic:mainfrom
DaveCTurner:2026/03/03/TransportAwaitClusterStateVersionAppliedAction-cancellation

Conversation

@DaveCTurner
Copy link
Copy Markdown
Member

Today TransportAwaitClusterStateVersionAppliedAction remains
subscribed to the ClusterApplierService after cancellation, and this
subscription retains a reference to its inner listener even when
complete.

This commit moves to using a SubscribableListener, avoiding retaining
the inner listener after completion, and subscribes directly to the
ClusterApplierService so that it can unsubscribe promptly on
cancellation.

…dAction`

Today `TransportAwaitClusterStateVersionAppliedAction` remains
subscribed to the `ClusterApplierService` after cancellation, and this
subscription retains a reference to its inner listener even when
complete.

This commit moves to using a `SubscribableListener`, avoiding retaining
the inner listener after completion, and subscribes directly to the
`ClusterApplierService` so that it can unsubscribe promptly on
cancellation.
@DaveCTurner DaveCTurner requested a review from lkts March 3, 2026 14:08
@DaveCTurner DaveCTurner added >non-issue :Distributed/Cluster Coordination Cluster formation and cluster state publication, including cluster membership and fault detection. v9.4.0 labels Mar 3, 2026
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Meta label for distributed team. label Mar 3, 2026
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

Comment on lines +171 to +172
r -> onceListener.addListener(ActionListener.running(r)),
onceListener
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

May seem a bit odd to pass in onceListener and a lambda that binds onceListener separately here - I have a potential change incoming that will pass in different listeners here hence the distinction. But we can just use onceListener if you'd prefer and I'll separate them later.

Copy link
Copy Markdown
Contributor

@lkts lkts left a comment

Choose a reason for hiding this comment

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

Thanks!

@DaveCTurner DaveCTurner enabled auto-merge (squash) March 3, 2026 17:10
@DaveCTurner DaveCTurner merged commit f7f45e8 into elastic:main Mar 3, 2026
35 checks passed
GalLalouche pushed a commit to GalLalouche/elasticsearch that referenced this pull request Mar 3, 2026
…dAction` (elastic#143477)

Today `TransportAwaitClusterStateVersionAppliedAction` remains
subscribed to the `ClusterApplierService` after cancellation, and this
subscription retains a reference to its inner listener even when
complete.

This commit moves to using a `SubscribableListener`, avoiding retaining
the inner listener after completion, and subscribes directly to the
`ClusterApplierService` so that it can unsubscribe promptly on
cancellation.
szybia added a commit to szybia/elasticsearch that referenced this pull request Mar 3, 2026
…locations

* upstream/main: (51 commits)
  ESQL: Remaining serialization tests (elastic#143470)
  Eagerly release resources in `TransportAwaitClusterStateVersionAppliedAction` (elastic#143477)
  Stop and relocate sliced reindex on shutdown (elastic#143183)
  Documentation for query_vector base64 parameter (elastic#142675)
  ES|QL: Fix LIMIT after all columns are dropped (elastic#143463)
  Update docs-build.yml (elastic#142958)
  Fix KnnIndexTester to work with byte vectors (elastic#143493)
  Fix IndexInputUtils.withSlice to produce native-safe MemorySegments on Java 21 (elastic#143479)
  CPS fix: include only relevant projects in the search response metadata (elastic#143367)
  apm-data: explicit map of timestamp.us to long (elastic#143173)
  [Inference API] Add custom headers for Azure OpenAI Service (elastic#142969)
  ESQL: Add name IDs to golden tests and fix synthetic names (elastic#143450)
  Add getUnavailableShards to BaseBroadcastResponse (elastic#143406)
  Add description to reindex API without sensitive info (elastic#143112)
  SQL: fix CLI tests (elastic#143451)
  ES|QL: Add note of future removal of FORK implicit LIMIT (elastic#143457)
  [Test] Randomly disable doc values skippers in time-series indices (elastic#143389)
  Improve pattern text downgrade license test (elastic#143102)
  [Transform] Stop transforms at the end of tests (elastic#139783)
  Mute org.elasticsearch.compute.lucene.read.ValueSourceReaderTypeConversionTests testLoadAll elastic#143471
  ...
shmuelhanoch pushed a commit to shmuelhanoch/elasticsearch that referenced this pull request Mar 4, 2026
…dAction` (elastic#143477)

Today `TransportAwaitClusterStateVersionAppliedAction` remains
subscribed to the `ClusterApplierService` after cancellation, and this
subscription retains a reference to its inner listener even when
complete.

This commit moves to using a `SubscribableListener`, avoiding retaining
the inner listener after completion, and subscribes directly to the
`ClusterApplierService` so that it can unsubscribe promptly on
cancellation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed/Cluster Coordination Cluster formation and cluster state publication, including cluster membership and fault detection. >non-issue Team:Distributed Meta label for distributed team. v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants