Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

SocketcanBus.send() timeout semantics differ from BusABC.send()

Aberta
#2,005 0 comentários 0 reações 0 responsáveis Ver no GitHub

@jafrivacation já está trabalhando nisso.

Desde 29/6/2026.

  • #2073 de @jafrivacation — aberto

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
45/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
linux, python

Direção de pesquisa

Comece comparando a implementação de SocketcanBus.send() com a documentação e o comportamento de BusABC.send() e, em seguida, reproduza o caso de fila cheia descrito com o loop de envio fornecido. Está concluído quando a ausência de um timeout seguir a semântica de bloqueio documentada, enquanto timeouts explícitos mantiverem o comportamento indicado; adicione ou atualize a cobertura para esses casos se os locais de teste existentes forem encontrados.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

bug
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

Linguagem predominante
Python
Estrelas
1.6k
Forks
700
Métricas de merge de PRs
Nenhum PR com merge em 30d

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de hardbyte/python-can

Todas as issues de hardbyte/python-can

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.