trajectory_group_batches leaves started rollouts running after close, error or cancellation
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Read src/art/batches.py and the assumptions in test_batches_completion_bursts.py. Reproduce the iterator-close case with the supplied asyncio example, then examine cleanup when the generator exits, including error and cancellation paths. Done means started tasks are cancelled and awaited, completed task exceptions are retrieved, and batching, ordering, exception-budget behavior, and ownership of unstarted coroutines remain as described; an open linked pull request already addresses this issue.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
art.trajectory_group_batches starts rollouts as asyncio tasks, but it never cancels or awaits them when it stops early. Three ordinary exits leave started rollouts running with no owner:
- the training loop closes the iterator (
breakout ofasync for, oraclose()), - a rollout raises past
max_batch_exceptions, - the task consuming the iterator is cancelled.
The orphaned rollouts keep calling the inference server and stepping environments after the training loop has stopped. In a long-lived event loop (a notebook or a server), nothing cleans them up until they finish on their own.
Reproduced on main at 5f0c1fb, Python 3.12. No model or service needed:
import asyncio
import art
async def main():
entered, release = asyncio.Event(), asyncio.Event()
effects = []
async def slow_rollout():
entered.set()
await release.wait()
effects.append("finished after iterator close")
return art.TrajectoryGroup([art.Trajectory(reward=1)])
async def first_rollout():
await entered.wait()
return art.TrajectoryGroup([art.Trajectory(reward=0)])
batches = art.trajectory_group_batches(
[first_rollout(), slow_rollout()],
batch_size=1, max_concurrent_batches=2, pbar_desc=None,
)
await anext(batches)
await batches.aclose()
release.set()
await asyncio.sleep(0.1)
print(effects)
asyncio.run(main())
Output: ['finished after iterator close']. Expected: []. After aclose() returns, the second rollout should already be cancelled.
There is a related leak on the error path. When several tasks finish in the same asyncio.wait, task.result() raises on the first failure. The other failed tasks in done are never read, so asyncio logs Task exception was never retrieved for each.
Cause: src/art/batches.py keeps the started tasks in pending and has no try/finally around the loop.
Expected fix: on any exit, cancel and await the tasks the generator started, and retrieve the exceptions of tasks that already finished. Coroutines that were never started stay owned by the caller, as test_batches_completion_bursts.py already assumes. Batching, ordering and exception-budget semantics stay the same. #969 changes the exception budget, not cleanup, so it doesn't overlap.
- Ngôn ngữ chính
- Python
- Star
- 10.8k
- Fork
- 1k
- Merge trung bình
- 12 giờ 33 phút
- Pull request đã merge (30 ngày)
- 126
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của OpenPipe/ART
-
gather_trajectory_groups / gather_trajectories leave sibling rollouts running after a failureCó thể đã có người làm @salma2vec đã nhận 7 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Distributed group_mean casts group ids to float32, losing precision vs non-distributed pathCó thể đã có người làm @OnePunchMonk đã nhận 26 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Add from_entity parameter to _experimental_fork_checkpointCó thể đã có người làm @Boulea7 đã nhận 3 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
ruler_score_group drops group exceptions, metadata and metrics, and trajectory policy versionsCó thể đã có người làm @salma2vec đã nhận 7 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
LocalBackend/Unsloth: gradient_accumulation_steps > 1 hangs the trainer (producer waits for one result per sequence)Có thể đã có người làm @monsterlag đã nhận 8 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 15/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
factory
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Arize-ai/phoenix#17420 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
FireDynamics/LEDSmokeAnalysis#176 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
PC
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Make `ocifs` optionalĐang mởdependencies
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
dlt-contrib/dlt-filesystem#51 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày