Cluster bring-up can leave processes running when it is interrupted or the client cannot connect
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- backend, distributed-systems
Hướng nghiên cứu
Read the cluster bring-up paths in pybnf.main(), focusing on LocalCluster(...), the dask ssh client connection and readiness wait, and wait_for_srun_workers. Trace how each path handles KeyboardInterrupt and failures, then check the related LocalCluster.close(timeout=TEARDOWN_TIMEOUT) behavior. Done means interrupted or failed bring-up cleans up the processes and scheduler files described here, with the reported teardown timeout handled as well.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Follow-up to #1063. That fix makes a local run close its LocalCluster at teardown, and also when local bring-up fails or is interrupted after LocalCluster(...) has returned. Its review found bring-up windows, on every cluster path, that still leave processes running. They are out of scope for #1063's PR, so they are collected here.
At a terminal the launchers share the process group and get the SIGINT themselves, so these mostly affect in-process use: a notebook, or the test suite calling pybnf.main(). In each case Cluster(...) never returns, so main() has no cluster to tear down.
1. Local: Ctrl-C while LocalCluster(...) is starting its workers
The #1063 guard (except BaseException) begins only after the constructor has returned and self._local_cluster is set. The constructor is nearly all of local bring-up. On a heavily loaded machine it measured 17.8 s, against 0.54 s for Client(lc) and 0.19 s for the init_logging broadcast. dask's own cleanup inside the constructor catches Exception only.
Reproduced with a real SIGINT during an in-process main(): "Fitting aborted.", exit 1, and 30 s later two workers were still alive with the LocalCluster still running. To make it deterministic, subclass LocalCluster and call signal.raise_signal(signal.SIGINT) at the end of __init__.
A candidate fix:
- Hold SIGINT while the constructor runs. Then, if one arrived, raise
KeyboardInterruptinside the existing guarded block, so the normal close path runs. - This was prototyped and passed both reproductions. Its cost is that Ctrl-C is unresponsive for the length of worker start-up.
- Closing the half-built instance from
SpecCluster._instancesdoes not work. Tried with a mid-start SIGINT, the cluster stuck atclosingwith both workers alive.
2. dask ssh: a failed client connection, or Ctrl-C during the readiness wait
Client(f'{scheduler_node}:8786')is outside any guard. If it raises, thedask sshprocess PyBNF started keeps running.wait_for_ssh_workers, which can take up toSSH_WORKER_TIMEOUT(120 s), is guarded byexcept Exception, so a Ctrl-C there leavesdask sshrunning too.
3. srun: Ctrl-C during the readiness wait
wait_for_srun_workers is guarded by except Exception. A Ctrl-C there leaves the srun worker launcher(s), the scheduler and the scheduler file PyBNF wrote.
Items 2 and 3 behave the same on main as with the #1063 fix.
Related, in teardown
LocalCluster.close(timeout=TEARDOWN_TIMEOUT) raises TimeoutError on timeout and leaves the cluster closing with its workers alive. Cluster.stop_process kills a process that misses its timeout; nothing does that here. The error goes to the log file only ("Failed to tear down cluster"). This is unlikely at 30 s, since dask's nanny kills a worker about 4 s after asking it to stop. A run with SIGSTOPped workers and a 2 s timeout shows the behaviour.
- Ngôn ngữ chính
- Python
- Star
- 26
- Fork
- 25
- Merge trung bình
- 4 giờ 25 phút
- Pull request đã merge (30 ngày)
- 9
Chuẩn bị môi trường
- Có Dockerfile hoặc 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 lanl/PyBNF
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
min_objective stops a sampler run early and reports "Fitting complete": samplers should refuse itĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
-
bug minor
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 92/100
-
bug minor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Issue tương tự
-
docs(contributing): the two things that silently block a PRCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởavailable documentation good first issue
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 95/100
Nixitov/Riptide-Native#944 ·
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 88/100
JTHCode/secretguard#24 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: middleware documentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
omarelshamy25x/shamy-hijri#63 ·
Maintainer thường phản hồi trong vòng 1 ngày