Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

bus.send() fails with `No buffer space available` despite not reaching the timeout

オープン
#2,004 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
linux, python
領域
networking

調査の方向性

報告された SocketCAN エラーを起点として、can/interfaces/socketcan/socketcan.py の、特に send() と _send_once() から始めます。tests/cantest.py で再現し、タイムアウトが残っている間は繰り返し送信が再試行されることを確認します。完了条件は、バッファ領域が一時的に利用できない場合でも、100-frame のケースで早期に例外が発生しなくなることです。

索引モデルが issue の本文から書いたものです。

説明

bug
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
フォーク
697
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

hardbyte/python-can のほかの issue

hardbyte/python-can の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。