SocketcanBus.send() timeout semantics differ from BusABC.send()
Chưa có ai nhận issue nà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
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- linux, python
- Lĩnh vực
- embedded-iot, networking
Hướng nghiên cứu
Bắt đầu bằng cách so sánh triển khai của SocketcanBus.send() với tài liệu và hành vi của BusABC.send(), sau đó tái hiện trường hợp hàng đợi đầy được mô tả bằng vòng lặp gửi được cung cấp. Công việc được hoàn tất khi việc thiếu timeout tuân theo ngữ nghĩa chặn được ghi trong tài liệu, trong khi các timeout tường minh vẫn giữ nguyên hành vi đã nêu; hãy bổ sung hoặc cập nhật độ bao phủ cho các trường hợp này nếu tìm thấy các vị trí kiểm thử hiện có.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
In the send() method of BusABC, the optional timeout argument is documented as
If > 0, wait up to this many seconds for message to be ACK'ed or
for transmit queue to be ready depending on driver implementation.
If timeout is exceeded, an exception will be raised.
Might not be supported by all interfaces.
None blocks indefinitely.
but the SocketcanBus implementation of BusABC documents (and implements) it like this:
Wait up to this many seconds for the transmit queue to be ready.
If not given, the call may fail immediately.
It looks to me like the handling in SocketcanBus just doesn't conform to the expected interface, in particular it does
# If no timeout is given, poll for availability
if timeout is None:
timeout = 0
which results in nonblocking behavior and potentially raising can.CanOperationError("Transmit buffer full") instead of waiting indefinitely when no timeout is specified.
To Reproduce
msg = can.Message(
arbitration_id=0x123, is_extended_id=False, data=[1, 2, 3, 4, 5, 6, 7, 8]
)
with can.Bus(interface="socketcan", channel="can0") as bus:
for i in range(10000):
bus.send(msg)
Observe that sending fails if the sending rate exceeds the capacity of the bus, instead of blocking and waiting.
Expected behavior
As the timeout is None, blocking indefinitely until the transmit queue is ready, as specified in the BusABC.send() docs.
Additional context
OS and version: Ubuntu 24.04.3 LTS, 6.14.0-35-generic
Python version: Python 3.12.3
python-can version: 4.3.1
python-can interface/s (if applicable): socketcan, F81601 interface (PCI), Manufacturer provided driver
- Ngôn ngữ chính
- Python
- Star
- 1.6k
- Fork
- 697
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
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 hardbyte/python-can
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
hardbyte/python-can#2077 · 1 bình luận · 1 reaction ·
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
hardbyte/python-can#1922 · 1 reaction ·
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
hardbyte/python-can#2102 ·
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
hardbyte/python-can#2092 ·
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
hardbyte/python-can#2091 ·
Tất cả issue của hardbyte/python-can
Issue tương tự
-
triage/confirmed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
agentscope-ai/agentscope#2775 ·
-
comp/desktop P3 type/bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
NousResearch/hermes-agent#118866 ·
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
apache/cloudstack#14222 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100