pjfanning opened a new pull request, #492:
URL: https://github.com/apache/pekko-persistence-cassandra/pull/492

   ### Motivation
   
   Every `Reconciliation` instance starts a `reconciliation-tag-writers-N` 
system actor and offers no way to stop it, so the actor and its `TagWriter` 
children stay alive for the lifetime of the `ActorSystem`.
   
   The `uniqueActorNameCounter` in `Reconciliation` shows that repeated 
instantiation is expected — it avoids the name clash, but not the leak. The 
reconciler specs construct one per test case (`TruncateAllSpec`, 
`BuildTagViewForPersistenceIdSpec`, `DeleteTagViewForPersistenceIdSpec`, 
`RebuildAllPersisetceIdsSpec`), which is exactly how the tool is meant to be 
used, so instances accumulate.
   
   ### Modification
   
   - Add `Reconciliation.close()`, which stops the tag writers actor.
   - Document on the class that an instance should be closed once its 
operations have completed.
   - Update the reconciler doc snippets (`ReconciliationCompileOnly`, 
`AllPersistenceIdsMigrationCompileOnly`) and the events-by-tag docs to call it.
   
   ### Result
   
   Callers can release the actor when they are done reconciling instead of 
leaking it for the lifetime of the `ActorSystem`. `close()` is idempotent and 
safe to call more than once.
   
   ### Tests
   
   - `sbt "core/Test/testOnly 
org.apache.pekko.persistence.cassandra.reconciler.ReconciliationCloseSpec"` — 
passed. New spec, asserts the tag writers actor terminates on `close()` and 
that closing twice is safe. It needs no Cassandra, the tag writers actor is 
started eagerly and the queries are lazy.
   - `sbt "core/mimaReportBinaryIssues"` — passed.
   - `scalafmt --mode diff-ref=upstream/main --list` — no changes needed.
   - `git diff --check` — clean.
   - Cassandra integration tests not run — no local Cassandra (docker not 
running).
   
   ### References
   
   None - resource leak found while auditing actor and session lifecycles.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to