`concurrent.futures.Executor.map` temporarily exceeds its `buffersize` while collecting the next result
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 35.9k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
Bug report
Bug description:
Potential follow up after the merge of #125663 (introduce buffersize param in Executor.map).
"Bug": concurrent.futures.Executor.map temporarily exceeds its buffersize while collecting the next result:
Let's define:
results: Iterator = executor.map(fn, iterable, buffersize=buffersize)
What happens when calling next(results):
- fetch the next
argfrominterableand put a task forfn(arg)in the buffer - wait for next result to be available
- yield the collected result
So during step 2. the buffer's size is actually buffersize + 1.
If we want a strict guarantee that there is at most buffersize concurrent tasks even during a next, we have to swap step 1. and step 2.
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
- gh-131467
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.
Hướng nghiên cứu
Bắt đầu từ concurrent.futures.Executor.map và xem lại hành vi được mô tả liên quan đến việc thu thập kết quả tiếp theo. Kiểm tra PR được liên kết gh-131467 để hiểu công việc đã được triển khai. Hoàn thành nghĩa là đảm bảo buffer không bao giờ tạm thời vượt quá buffersize được yêu cầu trong khi next(results) chờ một kết quả.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- backend
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 25/100