Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

LssMaster accumulates data with external LSS master #577

Copy link
Copy link

Description

@sveinse
Issue body actions

As #574 was closed there is a specific issue with LssMaster in the current implementation:

If this library is together with another LSS master present on the physical bus, the input queue of LssMaster will be filled up with CAN messages, eventually leading to memory overload. It is only emptied when the LssMaster is actively used to send LSS commands. This is because Network creates an LssMaster instance and activates the subscription to the LSS messages.

self.lss = LssMaster()
self.lss.network = self
self.subscribe(self.lss.LSS_RX_COBID, self.lss.on_message_received)

canopen/canopen/lss.py

Lines 396 to 397 in f1a71da

def on_message_received(self, can_id, data, timestamp):
self.responses.put(bytes(data))

I think the simplest solution would be not to activate the subscription callback until LssMaster.__send_command() is called. It is also draining the queue at this point:

canopen/canopen/lss.py

Lines 377 to 379 in f1a71da

if not self.responses.empty():
logger.info("There were unexpected messages in the queue")
self.responses = queue.Queue()

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.