Skip to content

Multiple listeners if many can ids #150

@erwinschrodinger1

Description

@erwinschrodinger1

Description

I am building an application that needs to handle multiple ISO-TP request/response pairs simultaneously (multiple (txid, rxid) address pairs).

To achieve this, I am currently creating one NotifierBasedCanStack per address pair and attaching all of them to a single CAN bus and notifier.


Current Implementation

self.sockets: Dict[str, isotp.NotifierBasedCanStack] = {}

self.bus = can.Bus(interface=can_interface, channel=channel, bitrate=bitrate)
self.notifier = can.Notifier(self.bus, [])

for name, (txid, rxid) in addresses.items():
    sock = isotp.NotifierBasedCanStack(
        bus=self.bus,
        notifier=self.notifier,
        address=isotp.Address(
            addressing_mode=isotp.AddressingMode.Normal_29bits,
            txid=txid,
            rxid=rxid,
        ),
    )

    sock.start()

Problem

When scaling beyond ~10 (txid, rxid) pairs, I am also running a WebSocket server alongside the ISO-TP handling.

Under this load:

  1. The WebSocket connection becomes unstable
  2. It occasionally disconnects unexpectedly during operation

This leads me to suspect that the issue is not limited to ISO-TP performance alone, but that the overall process (or event handling/thread scheduling) is being overloaded or blocked.


Questions

  1. Is this usage pattern (multiple NotifierBasedCanStack instances sharing a single notifier) aligned with the intended design of the library?

  2. Is there a recommended way to handle multiple ISO-TP sessions concurrently on the same CAN bus?


Expected Guidance

I’m trying to understand the intended scaling model of the library and the recommended architecture for handling multiple concurrent ISO-TP communications efficiently.

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