-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
[SPARK-51591][PYTHON][CONNECT] Fix ThreadPoolExecutor failure in python 3.13 daily test #50332
Closed
+8
−3
Conversation
This file contains 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
LuciferYang
approved these changes
Mar 20, 2025
8d56e3e
to
7eb872a
Compare
22b5105
to
77a7e64
Compare
HyukjinKwon
approved these changes
Mar 24, 2025
merged to master |
post-merge check: https://github.com/apache/spark/actions/runs/14028046790 3.13 daily test is green now |
SauronShepherd
pushed a commit
to SauronShepherd/spark
that referenced
this pull request
Mar 25, 2025
…on 3.13 daily test ### What changes were proposed in this pull request? Fix ThreadPoolExecutor failure in python 3.13 daily build ### Why are the changes needed? in the last 3 weeks, python 3.13 daily build keeps failing with ``` File "/__w/spark/spark/python/pyspark/sql/connect/client/core.py", line 1823, in _handle_error raise error File "/__w/spark/spark/python/pyspark/sql/connect/client/core.py", line 1534, in _execute_and_fetch_as_iterator for b in generator: ^^^^^^^^^ File "<frozen _collections_abc>", line 360, in __next__ File "/__w/spark/spark/python/pyspark/sql/connect/client/reattach.py", line 146, in send self._release_all() ~~~~~~~~~~~~~~~~~^^ File "/__w/spark/spark/python/pyspark/sql/connect/client/reattach.py", line 241, in _release_all self._release_thread_pool.submit(target) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^ File "/usr/lib/python3.13/concurrent/futures/thread.py", line 171, in submit raise RuntimeError('cannot schedule new futures after shutdown') RuntimeError: cannot schedule new futures after shutdown ``` see https://github.com/apache/spark/actions/runs/13955602888/job/39065942222 In `ThreadPoolExecutor.submit`, this only happens when the pool is already shutdown: ``` def submit(self, fn, /, *args, **kwargs): with self._shutdown_lock, _global_shutdown_lock: if self._broken: raise BrokenThreadPool(self._broken) if self._shutdown: raise RuntimeError('cannot schedule new futures after shutdown') if _shutdown: raise RuntimeError('cannot schedule new futures after ' 'interpreter shutdown') f = _base.Future() w = _WorkItem(f, fn, args, kwargs) self._work_queue.put(w) self._adjust_thread_count() return f ``` ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? PR builder with ``` default: '{"PYSPARK_IMAGE_TO_TEST": "python-313", "PYTHON_TO_TEST": "python3.13"}' ``` ### Was this patch authored or co-authored using generative AI tooling? no Closes apache#50332 from zhengruifeng/py_pool_313. Authored-by: Ruifeng Zheng <[email protected]> Signed-off-by: Ruifeng Zheng <[email protected]>
kazemaksOG
pushed a commit
to kazemaksOG/spark-custom-scheduler
that referenced
this pull request
Mar 27, 2025
…on 3.13 daily test ### What changes were proposed in this pull request? Fix ThreadPoolExecutor failure in python 3.13 daily build ### Why are the changes needed? in the last 3 weeks, python 3.13 daily build keeps failing with ``` File "/__w/spark/spark/python/pyspark/sql/connect/client/core.py", line 1823, in _handle_error raise error File "/__w/spark/spark/python/pyspark/sql/connect/client/core.py", line 1534, in _execute_and_fetch_as_iterator for b in generator: ^^^^^^^^^ File "<frozen _collections_abc>", line 360, in __next__ File "/__w/spark/spark/python/pyspark/sql/connect/client/reattach.py", line 146, in send self._release_all() ~~~~~~~~~~~~~~~~~^^ File "/__w/spark/spark/python/pyspark/sql/connect/client/reattach.py", line 241, in _release_all self._release_thread_pool.submit(target) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^ File "/usr/lib/python3.13/concurrent/futures/thread.py", line 171, in submit raise RuntimeError('cannot schedule new futures after shutdown') RuntimeError: cannot schedule new futures after shutdown ``` see https://github.com/apache/spark/actions/runs/13955602888/job/39065942222 In `ThreadPoolExecutor.submit`, this only happens when the pool is already shutdown: ``` def submit(self, fn, /, *args, **kwargs): with self._shutdown_lock, _global_shutdown_lock: if self._broken: raise BrokenThreadPool(self._broken) if self._shutdown: raise RuntimeError('cannot schedule new futures after shutdown') if _shutdown: raise RuntimeError('cannot schedule new futures after ' 'interpreter shutdown') f = _base.Future() w = _WorkItem(f, fn, args, kwargs) self._work_queue.put(w) self._adjust_thread_count() return f ``` ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? PR builder with ``` default: '{"PYSPARK_IMAGE_TO_TEST": "python-313", "PYTHON_TO_TEST": "python3.13"}' ``` ### Was this patch authored or co-authored using generative AI tooling? no Closes apache#50332 from zhengruifeng/py_pool_313. Authored-by: Ruifeng Zheng <[email protected]> Signed-off-by: Ruifeng Zheng <[email protected]>
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?
Fix ThreadPoolExecutor failure in python 3.13 daily build
Why are the changes needed?
in the last 3 weeks, python 3.13 daily build keeps failing with
see https://github.com/apache/spark/actions/runs/13955602888/job/39065942222
In
ThreadPoolExecutor.submit
, this only happens when the pool is already shutdown:Does this PR introduce any user-facing change?
no
How was this patch tested?
PR builder with
Was this patch authored or co-authored using generative AI tooling?
no