VMM can hang while it starts the SIGWINCH listener with --console pty

Đang mở
#9,289 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

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
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
linux, rust
Lĩnh vực
backend, operating-systems

Hướng nghiên cứu

Read vmm/src/sigwinch_listener.rs, especially start_sigwinch_listener and the TX thread local; the report identifies the child startup and parent readiness read as the hang points. Trace how the listener is spawned and how its pipe signals readiness, then check that the fix avoids the reported deadlock during startup. Done means the listener can start without hanging during restore with --console pty.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Describe the bug

with --console pty, the VMM can hang for good while it starts the SIGWINCH listener. we see it about once in 5500 restores.

start_sigwinch_listener (vmm/src/sigwinch_listener.rs:245 on 66b8e382d) makes the child with a raw clone3 from the vmm thread, while other threads run. the first thing the child does with its pipe is TX.with(...) (line 172). TX is a thread_local! with a destructor (line 27), so its first use registers the destructor through glibc __cxa_thread_atexit_impl, which takes dl_load_lock. if another thread held that lock at the moment of the clone, the child waits for ever: it has only one thread, and nothing releases the lock. a raw clone3 also skips the glibc fork handlers that reset such locks.

the parent then waits for ever in rx.read_exact (line 265) for the readiness byte. the API thread still accepts requests, but the vmm thread never handles them.

stacks from one hang:

  • child (one thread, vmm): futex_wait on _rtld_global+2568 <- pthread_mutex_lock <- __cxa_thread_atexit_impl <- listener code
  • parent vmm thread: read on the pipe
  • parent main thread: pthread_join on the vmm thread
  • parent http-server and vmm_signal_handler: idle

To Reproduce

restore a VM with --console pty in a loop, with other restores and snapshots running on the host. one hang in 5570 restores here. it is a race, so we do not have a quick reproducer.

Version

seen on our build of main with patches that do not touch this file. sigwinch_listener.rs is the same on 66b8e382d.

VM configuration

--console pty --serial off, virtio-block, virtio-net, vsock, balloon.

Host: Debian 13, kernel 6.12, glibc 2.41.

Logs

nothing after the restore request.

a fix could keep the fd in a plain static, for example an AtomicI32, so the child never registers a TLS destructor.

we found these over a long stretch of testing on our side. today an AI agent wrote up the patches and the issues in one go.

Ngôn ngữ chính
Rust
Star
6.3k
Fork
786
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
195

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của cloud-hypervisor/cloud-hypervisor

Tất cả issue của cloud-hypervisor/cloud-hypervisor

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.