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

   Thanks both for the careful reviews. Addressed in the latest push 
(`b9c27909f20`):
   
   **@viirya** — reworded the race-correctness comment. It no longer attributes 
safety to the symmetric store-then-load on the volatile `closedTimeMs` (which, 
as you note, is StoreLoad/Dekker-vulnerable in isolation). It now points at 
`ConcurrentHashMap`'s per-key linearizability: if the cleanup `forEach` misses 
our freshly `compute`d entry, then our insert linearized *after* `close()`'s 
read of that key's bin; since `closedTimeMs` is written before that bin read 
(program order in `close()`) and our `compute()` precedes the `isClosing` read 
(program order here), transitivity forces the recheck to observe `isClosing == 
true`. Also dropped the "forEach reflects entries already present when it 
starts" wording since `forEach` is weakly consistent.
   
   **@cloud-fan** — good catch, that's the same bug class. A foreachBatch 
runner cleaner registered (planner ~L3594) after `close()` has passed 
`cleanUpAll()` (L404) can be missed by that reaper, and if my async `stop()` 
terminates the query before the cleaner's `onQueryTerminated` listener is in 
place, that reaper misses it too — stranding the Python worker. I added the 
symmetric guard to `CleanerCache.registerCleanerForQuery`: it re-checks 
`sessionHolder.isClosing` after inserting and cleans the runner up immediately 
if the session is closing, plus a regression test. The query strand was the 
confirmed production symptom; this closes the analogous runner strand in the 
same window.
   


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