SeeedBus: Crash occsionally.
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
- 55/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- python
- Lĩnh vực
- networking
Hướng nghiên cứu
Bắt đầu trong can/interfaces/seeedstudio/seeedstudio.py quanh dòng 279, nơi _recv_internal đọc từ thiết bị nối tiếp, và tái hiện lỗi bằng một vòng lặp open nhanh cùng recv(0.0). Kiểm tra các bài kiểm thử interface SeeedStudio hiện có, nếu có, và làm cho đường nhận không chặn xử lý lần đọc rỗng như kết quả không có thông báo được mong đợi mà không phát sinh TypeError.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
python-can crashes rarely with the error:
msg = self.bus.recv(0.0)
File "/nix/store/0amvifzhc5sv3p1b29dzwxd53njs74z3-python3.13-python-can-4.6.1/lib/python3.13/site-packages/can/bus.py", line 121, in recv
msg, already_filtered = self._recv_internal(timeout=time_left)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "/nix/store/0amvifzhc5sv3p1b29dzwxd53njs74z3-python3.13-python-can-4.6.1/lib/python3.13/site-packages/can/interfaces/seeedstudio/seeedstudio.py", line 279, in _recv_internal
end_packet = ord(self.ser.read())
TypeError: ord() expected a character, but string of length 0 found
To Reproduce
Use a while true loop to open the device quickly.
For my use-case, I needed to implement a flush_rx_buffer() function on user-level:
Please ignore my comments in the code, they may be outdated.
def flush_rx_buffer(self):
"""Discarding the received buffer."""
# As python-can does not implement any discarding of old messages, see:
# https://github.com/hardbyte/python-can/issues/1721
# The recv(0.0) is probably a non-blocking function, see:
# https://python-can.readthedocs.io/en/3.3.2/interfaces/socketcan.html
# That non-blocking function should return immediately.
while True:
msg = self.bus.recv(0.0)
if msg is None:
return
Expected behavior
Instead of a TypeError I expected to receive a None.
Additional context
OS and version: NixOS
Python version: 3.13
python-can version: 4.6.1
python-can interface/s (if applicable): seeedstudio
I'm using an asus nuc 15, so quite a fast CPU. I don't remember this error to appear on the slow raspberry pi pico.
Traceback and logs
def func():
return "hello, world!"
- 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ự
-
货币战争手改优先级配置缺少列表元素类型校验(P3) Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
syfoud/Simulated_Scepter#172 ·
-
A cancelled tests run makes the coverage comment workflow fail and reports it as a red check on main Đang mởarea: ci bug perceived difficulty: 3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Nitjsefnie-Harness-Commons/daedalus#921 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ClickHouse/clickhouse-connect#1057 ·