Skip to content

Error when attempting to stop messages with same arbitration ID #605

Closed
@sbourkedev

Description

@sbourkedev

This error is returned when attempting to stop messages that have the same arbitration ID

Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-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 occurred:

Traceback (most recent call last):
File "simple-nm-sim.py", line 238, in <module>
  sim.force_stop()
File "simple-nm-sim.py", line 179, in force_stop
  self.vin1_task.stop()
File "/usr/local/lib/python3.5/dist-packages/can/bus.py", line 218, in wrapped_stop_method
  original_stop_method()
File "/usr/local/lib/python3.5/dist-packages/can/interfaces/socketcan/socketcan.py", line 365, in stop
  send_bcm(self.bcm_socket, stopframe)
File "/usr/local/lib/python3.5/dist-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.

Below is the code snippet where messages are defined and also where messages are being stopped. pm_snapshot_task is stopped first then an error is thrown when attempting to stop vin1_task as it has the same arbitration ID.

self.pm_snapshot_msg = can.Message(
            arbitration_id=0x400,
            data=self.pm_snapshot_data,
            extended_id=False,
            dlc=8)

        self.nm_msg = can.Message(
            arbitration_id=0x51E,
            data=self.nm_data,
            extended_id=False,
            dlc=8)

        self.vs_msg = can.Message(
            arbitration_id=0x11,
            data=self.vs_data,
            extended_id=False,
            dlc=8)

        self.vin1_msg = can.Message(
            arbitration_id=0x400,
            data=self.vin1_data,
            extended_id=False,
            dlc=8)

Stopping the tasks

if self.pm_snapshot_task is not None:
            self.pm_snapshot_task.stop()
            self.pm_snapshot_task = None

        if self.vs_task is not None:
            self.vs_task.stop()
            self.vs_task = None

        if self.vin1_task is not None:
            self.vin1_task.stop()
            self.vin1_task = None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions