bus.send() fails with `No buffer space available` despite not reaching the timeout
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 48/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 停滯
- 技術堆疊
- linux, python
- 領域
- networking
研究方向
從 can/interfaces/socketcan/socketcan.py 開始,特別查看 send() 和 _send_once(),以回報的 SocketCAN 錯誤作為切入點。使用 tests/cantest.py 重現,並確認在 timeout 尚未結束時重複傳送會進行重試;完成標準是:當緩衝區空間暫時不可用時,100-frame 情況不再提前引發錯誤。
由索引模型根據 Issue 內容生成。
描述
Describe the bug
When sending a lot of packets very quickly to a physical socketcan bus, bus.send() raises a can.exceptions.CanOperationError: Failed to transmit: No buffer space available [Error Code 105] despite the timeout not being reached.
To Reproduce
Send 100 frames to a physical socketcan bus with timeout=1.0 for each frame and no delay between sending the frames.
Expected behavior
can.send() should retry transmission until buffer space is available or the timeout is exceeded.
Additional context
OS and version: Ubuntu 24.04
Python version: 3.12.3
python-can version: 4.6.1
python-can interface/s (if applicable): socketcan (for a CANable 2.0 running CANnectivity)
Traceback and logs
$ ip -d link show pcan-e
12: pcan-e: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can promiscuity 0 allmulti 0 minmtu 0 maxmtu 0
can state ERROR-ACTIVE restart-ms 0
bitrate 1024096 sample-point 0.746
tq 5 prop-seg 61 phase-seg1 62 phase-seg2 42 sjw 21 brp 1
gs_usb: tseg1 2..256 tseg2 2..128 sjw 1..128 brp 1..512 brp_inc 1
clock 170000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 tso_max_size 65536 tso_max_segs 65535 gro_max_size 65536 parentbus usb parentdev 1-7.3:1.0
$ time python tests/cantest.py
Traceback (most recent call last):
File "/home/gos/gena-sidl/Integration-Tests/env/lib/python3.12/site-packages/can/interfaces/socketcan/socketcan.py", line 889, in _send_once
sent = self.socket.send(data)
^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 105] No buffer space available
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/gos/gena-sidl/Integration-Tests/tests/cantest.py", line 12, in <module>
bus.send(msg, timeout=1.0)
File "/home/gos/gena-sidl/Integration-Tests/env/lib/python3.12/site-packages/can/interfaces/socketcan/socketcan.py", line 874, in send
sent = self._send_once(data, channel)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gos/gena-sidl/Integration-Tests/env/lib/python3.12/site-packages/can/interfaces/socketcan/socketcan.py", line 891, in _send_once
raise can.CanOperationError(
can.exceptions.CanOperationError: Failed to transmit: No buffer space available [Error Code 105]
SocketcanBus was not properly shut down
real 0m0.112s
user 0m0.099s
sys 0m0.013s
with the following test script:
#!/usr/bin/env python3
import can
N_PACKETS = 100
bus = can.Bus(interface="socketcan", channel="pcan-e")
data = bytes([0xAB] * 8)
for _ in range(N_PACKETS):
msg = can.Message(arbitration_id=1, is_extended_id=True, data=data)
bus.send(msg, timeout=1.0)
bus.shutdown()
- 主要語言
- Python
- 星號
- 1.6k
- 分支
- 700
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
hardbyte/python-can 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 88/100
hardbyte/python-can#2103 ·
-
Unhashable type for Systec interface errors可能已有人在做 @giri256 於 71 天前認領。 未關閉bug
難度 1/5 1 小時以內 新手友好度 78/100
hardbyte/python-can#2077 · 1 則留言 · 1 個 reaction ·
-
bug
難度 1/5 1 小時以內 新手友好度 68/100
hardbyte/python-can#1922 · 1 個 reaction ·
-
enhancement
難度 3/5 1-2 天 新手友好度 75/100
hardbyte/python-can#2104 ·
-
enhancement
難度 5/5 一週以上 新手友好度 30/100
hardbyte/python-can#2102 ·
查看 hardbyte/python-can 的全部 Issue
相似的 Issue
-
難度 1/5 1 小時以內 新手友好度 88/100
-
難度 1/5 1 小時以內 新手友好度 92/100
QuantEcon/lecture-python-programming#642 ·
維護者通常 1 天內回覆
-
area/config area/profiles comp/cli needs-decision P3 sweeper:risk-compatibility type/feature
難度 2/5 1-3 小時 新手友好度 82/100
NousResearch/hermes-agent#133697 ·
維護者通常 1 天內回覆
-
enhancement needs-triage
難度 1/5 1 小時以內 新手友好度 72/100
維護者通常 1 天內回覆
-
core
難度 2/5 1-3 小時 新手友好度 88/100
vectorize-io/hindsight#5279 ·
維護者通常 1 天內回覆