buffer overflow detected

edited February 2019 in Python

When trying to connect to the board I sometimes receive a buffer overflow error. I need help understanding the cause of this issue and how to resolve it. I've attached a .txt file with the error. Thanks.


  • There is not much to work with without a line number or a log of bt adapger activity. A script that reliably reproduces this behavior would also be helpful.

  • edited February 2019

    I've edited one of the example log scripts to see if it was possible to handle disconnection while downloading a log. It seems to work like I hoped it would, but will sometimes have the buffer overflow error. When removing the the disconnect_download function and instead walking out of range with the MetaMotion R during the download and walking back to reconnect, it seems to always have a buffer overflow. I've attached the python script in .txt format.
    Edit: I included the hci trace of the bluetooth activity when running the script and eventually getting the buffer overflow error.

  • I ran your script on my Linux VM however I am seeing a different issue than buffer overflow. In my case, I was hitting an IndexError so I had to add a length check for imu_data.

    if (len(imu_data) > 0):
        print("\nData Length: ", (imu_data[-1][0] - imu_data[0][0])/1000, "seconds")
        print("Start Time: ", time.ctime(imu_data[0][0]/1000))
        print("End Time: ", time.ctime(imu_data[-1][0]/1000), "\n")

    The script ran fine for me after adding the length check.

  • edited February 2019

    If that index error occurs it likely means that no data was recorded and appended to the list. The imu_data list contains the data from the downloaded log, and is cleared at the end of every loop. This could be because there were no remaining entries available in the device and did not save any new data. Have you tried commenting out the disconnect_download function and disconnecting the device by taking the imu out of range during a download, then reconnecting it by bringing it back in range? This seems to be the most reliable way to get the buffer overflow error on my side.

  • Any suggestions on what could be the issue or what I could try? This buffer overflow sometimes occurs in any script that I run and is very problematic to scripts that need to reconnect to the board.

  • I tried walked out of range but have not run into any issues.

    Without debug versions of C code, it will be hard to determine what is actually going on. You can build debug versions of libmetawear and libwarble and use gdb to inspect the backtrace when this issue occurs again.

Sign In or Register to comment.