dbtsai commented on PR #56377:
URL: https://github.com/apache/spark/pull/56377#issuecomment-4654650618

   Addressed the listener-lifecycle nuance (commit `1cee9cbb1cb`). cc @viirya 
@cloud-fan
   
   `streamingListener` was a one-shot lazy val, so once `cleanUpAll()` removed 
it, a later `registerCleanerForQuery()` would reuse the already-created 
listener instance without re-adding it to `session.streams` -- the runner would 
be cached but never reaped on termination. Safe today since `cleanUpAll()` is 
close-path only and registration fast-paths on `isClosing`, but it made 
correctness depend on that being the sole caller.
   
   Replaced the lazy val + volatile flag with an explicit, `this`-synchronized 
register/remove pair over a nullable field: after removal a later registration 
re-adds a fresh listener, so the cache is safe to reuse. The synchronization 
also gives a real happens-before between registration and cleanup (rather than 
relying on volatile StoreLoad ordering). Added a test that the listener is 
re-registered after `cleanUpAll()`.
   
   I believe that resolves all the review findings so far -- thanks for the 
thorough lifecycle passes.
   


-- 
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