You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A GZipFile object implementation in cpython is unable to be sought negatively while in write mode. This is problematic for the BLFWriter. Upon initialization, the BLFWriter writes a default header to the file, in which the start and stop timestamps are not set. Once the BLFWriter is told to stop, the remaining data in the buffer is flushed to the file and then the header must be updated with the start and stop timestamps. This is where the GZipFile object has problems. The location of the writer must be moved to the 0'th position of the file. When in write mode, the offset position cannot be negatively sought.
To Reproduce
Socket CAN setup
Enable CAN interface:
sudo ip link add dev vcan0 type vcan && sudo ip link set up vcan0
j-c-cook
changed the title
Fix the compressed BLFWriter and compressed SizedRotatingLogger rollover
GzipFile BLFWriter negative seek error
Aug 27, 2022
... it is also quite unnecessary to gzip a blf file since it already uses compression internally.
This is something that would be useful to quantify. I am using secure copy protocol, scp, to transfer CAN logs from a remote device to a server. I have ensured that the files being transferred are zipped due to some previous experiences (empiricism).
I have found in the past when transferring many files or even just one large file with scp that a zipped file is transported much faster. I am curious though now that you say this, in the case of blf versus blf.gz, what the percent difference in transfer time is.
Describe the bug
A GZipFile object implementation in
cpython
is unable to be sought negatively while in write mode. This is problematic for theBLFWriter
. Upon initialization, theBLFWriter
writes a default header to the file, in which the start and stop timestamps are not set. Once theBLFWriter
is told to stop, the remaining data in the buffer is flushed to the file and then the header must be updated with the start and stop timestamps. This is where theGZipFile
object has problems. The location of the writer must be moved to the 0'th position of the file. When in write mode, the offset position cannot be negatively sought.To Reproduce
Socket CAN setup
Enable CAN interface:
sudo ip link add dev vcan0 type vcan && sudo ip link set up vcan0
Generate random CAN messages 1 millisecond apart:
cangen vcan0 -e -I 18EAFF26 -L i -v -v -v -g 1
python-can setup
Enable the
Logger
:python -m can.logger -c vcan0 -i socketcan -b 250000 -f file.blf.gz
The issue can be seen with the
SizedRotatingLogger
as well.python -m can.logger -c vcan0 -i socketcan -b 250000 -f file.blf.gz -s 150000
Expected behavior
A
file.blf.gz
should be created without error.Additional context
OS and version: Kubuntu 22.04
Python version: 3.7.13
python-can version:
pip install git+https://github.com/hardbyte/python-can@2da28c1a1c87776618a60218b0b97800cf2deb34
python-can interface/s (if applicable):
Traceback and logs
Logger
trace back:SizedRotatingLogger
trace back:The text was updated successfully, but these errors were encountered: