Multiprocessing Client connection, send call is blocking when multiple threads try to connect to IPC Server which is offline/down/not running

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

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
42/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
backend, networking

Hướng nghiên cứu

Bắt đầu từ entry point multiprocessing.connection.Client và tái hiện vấn đề trên Windows 10 với ba thread khi máy chủ IPC đang offline. Truy vết lý do chỉ một lệnh gọi trả về ngoại lệ từ chối kết nối; công việc được xem là hoàn tất khi mọi thread đều trả về thay vì tiếp tục bị chặn, kèm coverage hồi quy cho kịch bản này.

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

Mô tả

topic-multiprocessing type-bug

Bug report

When multiple threads access send call of multiprocessing Client to connect to server via IPC, the threads are blocked forever. This occurs when IPC server is down and the client tries to connect to server.

CODE:

from multiprocessing.connection import Client
def ipc_send(data={}):
    try:
        address = ('localhost', 56000)
        print("ipc address: ", address)
        conn = Client(address, authkey="SOMESECRET")
        conn.send(data)
        res = conn.recv()
        conn.close()
        return True
    except Exception as e:
        print(e)
    return None

As server is down, when ipc_send() is called by 3 different threads(including main thread), suprisingly only one thread has returned None with exception: [WinError 10061] No connection could be made because the target machine actively refused it.

It is trivial that Error would be connection refused as server is down, but only one thread has thrown the error and rest of the 2 threads are possibly blocked at

conn = Client(address, authkey="SOMESECRET")

Your environment

Python 3.8.8
OS: Windows 10.

Ngôn ngữ chính
Python
Star
77.2k
Fork
36k
Merge trung bình
1 ngày 9 giờ
Pull request đã merge (30 ngày)
558

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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 python/cpython

Tất cả issue của python/cpython

Issue tương tự

Thêm issue về Python

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.