L. C. Hsieh created SPARK-60113:
-----------------------------------

             Summary: Wait for the pipelined Python UDF writer to exit before 
task completion cleanup
                 Key: SPARK-60113
                 URL: https://issues.apache.org/jira/browse/SPARK-60113
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 5.0.0
            Reporter: L. C. Hsieh


In pipelined Python UDF mode (SPARK-56642), the task completion listener in 
BasePythonRunner calls writerFuture.cancel(true) and then writerFuture.get() to 
wait for the writer thread to exit before later listeners free the input rows' 
memory (SPARK-33277). After a successful cancel(true), FutureTask.get() throws 
CancellationException immediately and does not wait for the runnable to finish. 
The writer can therefore still be inside HybridRowQueue.add() (lock-free mode 
writes directly into the current page) when the queue-close listener frees that 
page, which is a use-after-free and can crash the JVM for off-heap pages. A 
createNewQueue racing with the close can also leak its page until task cleanup. 
The listener should wait for the writer to actually exit, e.g. on a latch the 
writer counts down in a finally block.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to