-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-54047][PYTHON] Use a difference error when kill-on-idle-timeout #52749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
ueshin
wants to merge
2
commits into
apache:master
from
ueshin:issues/SPARK-54047/kill_on_idle_timeout
Closed
[SPARK-54047][PYTHON] Use a difference error when kill-on-idle-timeout #52749
ueshin
wants to merge
2
commits into
apache:master
from
ueshin:issues/SPARK-54047/kill_on_idle_timeout
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HyukjinKwon
approved these changes
Oct 27, 2025
dongjoon-hyun
approved these changes
Oct 28, 2025
Member
Author
|
@allisonwang-db Could you also take a look to see this message sounds good? Thanks. |
Contributor
allisonwang-db
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! This will help users differentiate between different Python worker crash reasons.
core/src/main/scala/org/apache/spark/api/python/PythonRunner.scala
Outdated
Show resolved
Hide resolved
allisonwang-db
approved these changes
Oct 28, 2025
Member
Author
|
Thanks! merging to master. |
huangxiaopingRD
pushed a commit
to huangxiaopingRD/spark
that referenced
this pull request
Nov 25, 2025
### What changes were proposed in this pull request?
Uses a difference error message when kill-on-idle-timeout.
### Why are the changes needed?
Currently the error message when kill-on-idle-timeout is same as when the Python worker crashes.
```py
>>> from pyspark.sql.functions import udf
>>> import time
>>>
>>> udf
... def f(x):
... time.sleep(2)
... return str(x)
...
>>> spark.conf.set("spark.sql.execution.pyspark.udf.idleTimeoutSeconds", "1s")
>>> spark.conf.set("spark.sql.execution.pyspark.udf.killOnIdleTimeout", "true")
>>>
>>> spark.range(1).select(f("id")).show()
25/10/27 16:31:16 WARN PythonUDFWithNamedArgumentsRunner: Idle timeout reached for Python worker (timeout: 1 seconds). No data received from the worker process: handle.map(_.isAlive) = Some(true), channel.isConnected = true, channel.isBlocking = false, selector.isOpen = true, selectionKey.isValid = true, selectionKey.interestOps = 1, hasInputs = false
25/10/27 16:31:16 WARN PythonUDFWithNamedArgumentsRunner: Terminating Python worker process due to idle timeout (timeout: 1 seconds)
25/10/27 16:31:16 ERROR Executor: Exception in task 15.0 in stage 0.0 (TID 15)
org.apache.spark.SparkException: Python worker exited unexpectedly (crashed). Consider setting 'spark.sql.execution.pyspark.udf.faulthandler.enabled' or'spark.python.worker.faulthandler.enabled' configuration to 'true' for the better Python traceback.
...
```
It should show a different message to distinguish the cause:
```py
25/10/27 16:34:55 WARN PythonUDFWithNamedArgumentsRunner: Idle timeout reached for Python worker (timeout: 1 seconds). No data received from the worker process: handle.map(_.isAlive) = Some(true), channel.isConnected = true, channel.isBlocking = false, selector.isOpen = true, selectionKey.isValid = true, selectionKey.interestOps = 1, hasInputs = false
25/10/27 16:34:55 WARN PythonUDFWithNamedArgumentsRunner: Terminating Python worker process due to idle timeout (timeout: 1 seconds)
25/10/27 16:34:55 ERROR Executor: Exception in task 15.0 in stage 0.0 (TID 15)
org.apache.spark.api.python.PythonWorkerException: Python worker process terminated due to idle timeout (timeout: 1 seconds)
...
```
### Does this PR introduce _any_ user-facing change?
Yes, the error message when kill-on-idle-timeout is different.
### How was this patch tested?
Modified the related tests.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes apache#52749 from ueshin/issues/SPARK-54047/kill_on_idle_timeout.
Authored-by: Takuya Ueshin <ueshin@databricks.com>
Signed-off-by: Takuya Ueshin <ueshin@databricks.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Uses a difference error message when kill-on-idle-timeout.
Why are the changes needed?
Currently the error message when kill-on-idle-timeout is same as when the Python worker crashes.
It should show a different message to distinguish the cause:
Does this PR introduce any user-facing change?
Yes, the error message when kill-on-idle-timeout is different.
How was this patch tested?
Modified the related tests.
Was this patch authored or co-authored using generative AI tooling?
No.