SocketcanBus.send() timeout semantics differ from BusABC.send()
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- linux, python
調査の方向性
まず SocketcanBus.send() の実装を BusABC.send() のドキュメントおよび動作と比較し、次に、提供された送信ループで説明されているキュー満杯のケースを再現します。タイムアウトが指定されていない場合にドキュメント化されたブロッキングセマンティクスに従い、明示的なタイムアウトでは記載された動作が維持されれば完了です。既存のテスト箇所が見つかった場合は、これらのケースのカバレッジを追加または更新してください。
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Python
- スター
- 1.6k
- フォーク
- 697
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
hardbyte/python-can のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
hardbyte/python-can#2103 ·
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
hardbyte/python-can#2077 · コメント 1 件 · リアクション 1 件 ·
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
hardbyte/python-can#1922 · リアクション 1 件 ·
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
hardbyte/python-can#2102 ·
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
hardbyte/python-can#2092 ·
hardbyte/python-can の issue をすべて見る
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
canonical/paas-charm#368 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
tech debt
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
StevenBlack/hosts#3256 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
qualcomm/qai-appbuilder#275 ·