Forums - Segfault in mvVISLAM_AddImage

2 posts / 0 new
Last post
Segfault in mvVISLAM_AddImage
nico
Join Date: 3 Apr 18
Posts: 4
Posted: Wed, 2019-12-04 05:27

Hi everyone,

I'm using the mv library on the Snapdragon 845. I wrote a small application that calls the mvVISLAM_Initialize(...) function, followed by a call to mvVISLAM_AddAccel()  mvVISLAM_AddGyro() and mvVISLAM_AddImage().

About 50% of the calls to mvVISLAM_AddImage() result in a segmentation fault.

I've noticed a pattern though. The calls to mvVISLAM_Initialize(...)  yield some debug output on the console like

MachineVision is licensed as community user

LNX_8074 supported? 1
LNX_8096 supported? 1
LNX_IA64 supported? 1
WINDOWS supported? 1
AR ERROR: arFileOpen(): Failed to open file: /usr/bin/vislam/Configuration.SF.xml
FASTCV: fcvAvailableHardware Linux
mempool cur block size 307200, new block size -496943104
And whenever this "new block size" is negative, the application runs fine. If it's positive, it segfaults upon call to addImage().
 
My application's output on a successful attempt:
/usr/bin # ./vio
[VIOManager] Starting...
[tracker] _vio pointer should be NULL: 0
[tracker] Calling initialize function
MachineVision is licensed as community user
LNX_8074 supported? 1
LNX_8096 supported? 1
LNX_IA64 supported? 1
WINDOWS supported? 1
AR ERROR: arFileOpen(): Failed to open file: /usr/bin/vislam/Configuration.SF.xml
FASTCV: fcvAvailableHardware Linux
mempool cur block size 307200, new block size -496943104
[tracker] Now _vio pointer is: 0xb0ce20f8
[VIOManager] VISLAM tracker is not null, so you must've done something right!
[VIOManager] Setting callbacks for IMU and Camera...
[IMUDriver] Setting accel callback
[IMUDriver] Setting gyro callback
[CameraDriver] Setting image callback
[VIOManager] All callbacks set!
[VIOManager] Starting IMU...
[IMUDriver] Sending fake accel data to VIO
[tracker] Calling mvVISLAM_AddAccel
[IMUDriver] Sending fake gyro data to VIO
[tracker] Calling mvVISLAM_AddGyro
[VIOManager] IMU started
[VIOManager] Starting camera...
[CameraDriver] Sending fake image to VIO
[tracker] Calling mvVISLAM_AddImage
[VIOManager] Camera started
 
 
And on a segfault:
/usr/bin # ./vio
[VIOManager] Starting...
[tracker] _vio pointer should be NULL: 0
[tracker] Calling initialize function
MachineVision is licensed as community user
LNX_8074 supported? 1
LNX_8096 supported? 1
LNX_IA64 supported? 1
WINDOWS supported? 1
AR ERROR: arFileOpen(): Failed to open file: /usr/bin/vislam/Configuration.SF.xml
FASTCV: fcvAvailableHardware Linux
mempool cur block size 307200, new block size 1885421568
[tracker] Now _vio pointer is: 0xaf413108
[VIOManager] VISLAM tracker is not null, so you must've done something right!
[VIOManager] Setting callbacks for IMU and Camera...
[IMUDriver] Setting accel callback
[IMUDriver] Setting gyro callback
[CameraDriver] Setting image callback
[VIOManager] All callbacks set!
[VIOManager] Starting IMU...
[IMUDriver] Sending fake accel data to VIO
[tracker] Calling mvVISLAM_AddAccel
[IMUDriver] Sending fake gyro data to VIO
[tracker] Calling mvVISLAM_AddGyro
[VIOManager] IMU started
[VIOManager] Starting camera...
[CameraDriver] Sending fake image to VIO
[tracker] Calling mvVISLAM_AddImage
Segmentation fault (core dumped)
 
 
  • Up0
  • Down0
gmcgrath
Join Date: 21 Aug 13
Posts: 60
Posted: Wed, 2019-12-04 14:20

The negative sign is probably just a symptom.  If one looks in the mvMemoryPool.h code that your application must be using, the requested memory size comes as a size_t and the printf just uses a %d character instead of %zu to printf it.  So, the requested memory is large enough to hit the negative space.  It seems then that your application is feeding it a bad memory size request.  So, maybe your actual image size is different than the code has everywhere or maybe pool.releaseBlock() is not getting called in the right spot?

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.