jrl-umi3218 / mc_rtc

mc_rtc is an interface for simulated and real robotic systems suitable for real-time control
BSD 2-Clause "Simplified" License
122 stars 36 forks source link

mc_log_ui cannot load the log file when I change the controller and put it back #403

Closed orikuma closed 1 year ago

orikuma commented 1 year ago

When I changed and put back controllers, for example A->B->A, log files named A1, B1, A2 are created. However, when I try to load A2 by mc_log_ui, it raised SEGV as follows.

$ mc_log_ui mc-control-MultiContactController-2023-10-26-12-43-52.bin
Segmentation fault (core dumped)
Traceback (most recent call last):
  File "/home/iori/workspace/install/bin/mc_log_ui", line 20, in <module>
    gui.load_csv(fpath, False)
  File "/home/iori/workspace/install/lib/python3.8/site-packages/mc_log_ui/mc_log_ui.py", line 1445, in load_csv
    data = read_log(fpath)
  File "/home/iori/workspace/install/lib/python3.8/site-packages/mc_log_ui/mc_log_ui.py", line 116, in read_log
    return read_log(tmpf[1], True)
  File "/home/iori/workspace/install/lib/python3.8/site-packages/mc_log_ui/mc_log_ui.py", line 118, in read_log
    return read_flat(fpath, tmp)
  File "/home/iori/workspace/install/lib/python3.8/site-packages/mc_log_ui/mc_log_ui.py", line 73, in read_flat
    nrEntries = read_size(fd)
  File "/home/iori/workspace/install/lib/python3.8/site-packages/mc_log_ui/mc_log_ui.py", line 51, in read_size
    return ctypes.c_size_t.from_buffer_copy(
ValueError: Buffer size too small (0 instead of at least 8 bytes)

When I loaded A1 or B1, this error did not happen.

gergondet commented 1 year ago

Hi @orikuma

Thanks for reporting this. I was able to reproduce the issue and fix it with the above commit. Unfortunately I don't think the A2 log in that case can be recovered easily but once mc_rtc is updated to include this patch the issue should not happen again.