Skip to content

send_periodic with SocketCan fails to stop when several tasks are running #720

@PaulErny

Description

@PaulErny

Hi,

Looks like trying to stop several send_periodic tasks at the same time fails with SocketCan on Raspberry Pi.

task = bus.send_periodic(msg, period)
task2 = bus.send_periodic(msg2, period2)
task.stop()
task2.stop()

Here is the error message:

Traceback (most recent call last):
  File "/home/pi/venv/lib/python3-6/site-packages/can/interfaces/socketcan/socketcan.py", line 280, in send_bcm
    return bcm_socket.send(data)
OSError: [Errno 22] Invalid argument

During handling of the above exception, another exception accurred:

Traceback (most recent call last):
  File "test.py", line 9, in <module>
    task2.stop()
  File "/home/pi/venv/lib/python3-6/site-packages/can/interfaces/can/bus.py", line 218, in wrapped_stop_method
    original_stop_method()
  File "/home/pi/venv/lib/python3-6/site-packages/can/interfaces/socketcan/socketcan.py", line 365, in stop
    send_bcm(self.bcm_socket, stopframe)
  File "/home/pi/venv/lib/python3-6/site-packages/can/interfaces/socketcan/socketcan.py", line 285 in send_bcm
    raise can.CanError(base + "You are probably referring to a non-existing frame.")
can.CanError: Couldn't send CAN BCM frame. OS Error 22: Invalid argument
You are probably referring to a non-existing frame.

I'm using python-can 3.3.2 on a 32 bits Raspbian stretch (v9.4)

Here is the output of uname -a:

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.14.71-v7+ #1145 SMP Fri Sep 21 15:38:35 BST 2018 armv7l GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions