You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Ivan Sadikov (Jira)" <ji...@apache.org> on 2026/04/02 03:13:00 UTC
[jira] [Created] (SPARK-56330) Add TaskInterruptListener to TaskContext for interrupt notifications
Ivan Sadikov created SPARK-56330:
------------------------------------
Summary: Add TaskInterruptListener to TaskContext for interrupt notifications
Key: SPARK-56330
URL: https://issues.apache.org/jira/browse/SPARK-56330
Project: Spark
Issue Type: Bug
Components: Spark Core
Affects Versions: 4.2.0
Environment: Spark implements task cancellation via polling. Code must call TaskContext#killTaskIfInterrupted() periodically to check whether the current task has been cancelled and abort if so. This works well for simple iterator loops, but has two limitations:
{*}- No push notification{*}: There is no way to register a callback that fires immediately when a task is interrupted. This precludes patterns like atomically setting a flag (to make future polls cheaper) or waking up a thread blocked on I/O or a lock.
{*}- No immediate reaction{*}: If a component wants to react to cancellation outside of its hasNext() loop (e.g., to unblock a waiting thread), it must rely on a separate polling mechanism.
Additionally, TaskKilledException does not pass the reason string to the RuntimeException constructor, so getMessage() returns null instead of the cancellation reason.
Reporter: Ivan Sadikov
--
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