Skip to content

Commit 8c98fa1

Browse files
owenowenismepeterxcli
authored andcommitted
[Data] Close threads from async UDF after actor died (ray-project#59261)
## Description When using async map with actors in Ray Data, the asyncio thread can keep the actor process alive and block shutdown even after the actor is marked as dead. This occurs because the asyncio thread does not exit when the main thread finishes. To fix this, we create the thread with `daemon=True`, ensuring it terminates when the main thread exits. ## Related issues Closes ray-project#59033 Signed-off-by: You-Cheng Lin <mses010108@gmail.com> Signed-off-by: peterxcli <peterxcli@gmail.com>
1 parent 38043bd commit 8c98fa1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python/ray/data/_internal/planner/plan_udf_map_op.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def run_loop():
9999
asyncio.set_event_loop(loop)
100100
loop.run_forever()
101101

102-
thread = Thread(target=run_loop)
102+
thread = Thread(target=run_loop, daemon=True)
103103
thread.start()
104104
self.udf_map_asyncio_loop = loop
105105
self.udf_map_asyncio_thread = thread

0 commit comments

Comments
 (0)