hardbyte / hardbyte/python-can

CANalyst-II can't reopen device

Open
#1,294 6 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
1.6k
Forks
697
PR merge metrics
No merged PRs in 30d

Description

Hello! I use your library with CANalyst-II device and it works pretty well, thank you!
But I have one problem, first run of program is fully successful, but when I quit it and start again it throws error like:

```
msg = self.bus.recv(1)
File "/home/anton/.local/lib/python3.8/site-packages/can/bus.py", line 94, in recv
msg, already_filtered = self._recv_internal(timeout=time_left)
File "/home/anton/.local/lib/python3.8/site-packages/can/interfaces/canalystii.py", line 177, in _recv_internal
self.poll_received_messages()
File "/home/anton/.local/lib/python3.8/site-packages/can/interfaces/canalystii.py", line 157, in poll_received_messages
(channel, raw_msg) for raw_msg in self.device.receive(channel)
File "/home/anton/.local/lib/python3.8/site-packages/canalystii/device.py", line 259, in receive
assert len(rx_data) % self.MESSAGE_BUF_LEN == 0
AssertionError
free(): double free detected in tcache 2
```
If I replug device everything is Ok again.
In code it is looks like:
```python
self.bus = can.interface.Bus(bustype="canalystii", channel="0", bitrate=125000)
...
while True:
msg = self.bus.recv(1)
...
self.bus.shutdown()
```

OS and version: Kubuntu 20.04
Python version: 3.8.10
python-can version: 4.0.0
python-can interface/s: canalystii==0.1

Any ideas?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.