-
-
Notifications
You must be signed in to change notification settings - Fork 84
Multiple listeners if many can ids #150
Description
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:
- The WebSocket connection becomes unstable
- 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
-
Is this usage pattern (multiple
NotifierBasedCanStackinstances sharing a single notifier) aligned with the intended design of the library? -
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.