You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "L. C. Hsieh (Jira)" <ji...@apache.org> on 2026/10/09 23:56:00 UTC

[jira] [Updated] (SPARK-60113) Wait for the pipelined Python UDF writer to exit before task completion cleanup

     [ https://issues.apache.org/jira/browse/SPARK-60113?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

L. C. Hsieh updated SPARK-60113:
--------------------------------
    Affects Version/s: 4.3.0
                       4.4.0
                           (was: 5.0.0)

> 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: 4.3.0, 4.4.0
>            Reporter: L. C. Hsieh
>            Priority: Major
>
> 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: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org