Tracking Tools access violation exception

Post Reply
pdenbrook
Posts: 3
Joined: Fri Dec 01, 2006 7:17 am

Tracking Tools access violation exception

Post by pdenbrook »

Under certain circumstances, the Tracking Tools software appears to cause the application program to crash with a 0XC0000005 access violation exception. This occurs when Tracking Tools is linked to a dynamically loaded interface DLL (which handles calls to Tracking Tools on behalf of the main application program) and either [1] the OptiTrack cameras are not connected to the system or [2] both a TrackIR 5 camera and the OptiTrack cameras are connected to the system. The access violation occurs when the interface DLL is being terminated by the main application program (via a call to AfxFreeLibrary), specifically, just before the interface DLL returns from DLLMain.

The access violation does not occur when only OptiTrack cameras are connected to the system. When both TrackIR and OptiTrack cameras are connected via USB, the OptiTrack tracks normally, but causes an access violation exception upon termination. The TrackIR, however, does not track normally when the OptiTrack cameras are connected, further indicating there is some conflict going on between the devices.

Note that the access violation exception always occurs when the OptiTrack cameras are not connected to the system. A call to TT_Initialize() returns code 11 (invalid license), but otherwise there is no problem until termination. The access violation exception does not occur, however, if TT_Initialize() is not called, even if TT_FinalCleanup() is called before terminating.

Also note that the access violation exception usually (though not always) occurs when both TrackIR and OptiTrack cameras are connected.

I have isolated this behavior in a simple test program, which I can send to you upon request.
jolsonsalem
Posts: 323
Joined: Thu Oct 11, 2012 9:18 am

Re: Tracking Tools access violation exception

Post by jolsonsalem »

You can send the test program to support@naturalpoint.com

Also, which type of cameras beside the TrackIR are you using?
Friggincomputers
Posts: 2
Joined: Wed Jan 02, 2013 2:21 pm

Re: Tracking Tools access violation exception

Post by Friggincomputers »

I have a similar problem (with version 2.5.2 and V120:Duo); when dynamically loading the DLL, some of the initialization cause the enclosing function to crash on exit.


The DLL is loaded without any problem, the functions are retrieved correctly and all calls return "success". But the function enclosing this initialization (init) causes an access violation on exit. And only when compiled in release mode.

Simplified, this is the function that never returns:

Code: Select all

void NPTrackingTools::init()
{
    bool loadSuccess = trackingToolsDllLoad(); //::LoadLibrary(); ::GetProcAddress();
    if( loadSuccess )
    {
        if( mStatus == UNINITIALIZED )
        {
            NPRESULT initResult = FP_TT_Initialize();
            if( initResult == NPRESULT_SUCCESS )
                mStatus = INITIALIZED ;
        }
    }    

    if( mStatus == INITIALIZED )
    {
        NPRESULT projectLoadResult = FP_TT_LoadProject( filename );

        if( projectLoadResult == NPRESULT_SUCCESS )
        {
            if( FP_TT_TrackableCount() > TRACKABLE_INDEX && 
                FP_TT_TrackableEnabled(TRACKABLE_INDEX)     )
                mStatus = READY ;
            else
                mStatus = BAD_PROJECT ;
        }
        else
            mStatus = BAD_PROJECT ;
    }
}
Friggincomputers
Posts: 2
Joined: Wed Jan 02, 2013 2:21 pm

Re: Tracking Tools access violation exception

Post by Friggincomputers »

I figured out the problem:

The Trackingtools functions are __cdelc. I was defining my functions as __stdcall.
orhirshfeld
Posts: 16
Joined: Tue Jun 17, 2014 9:42 am

Re: Tracking Tools access violation exception

Post by orhirshfeld »

I have similar problem when using Matlab with Tracking Tools or Motive

first i tried using LoadLib and CallLib and get errors

Than i tried using C Mex file and got also an error
so i debug it using Visual Studio and got the following message
Unhandled exception at 0x000007FEDBEEFD1D (NPTrackingToolsx64.dll) in MATLAB.exe: 0x80000001: Not implemented (parameters: 0x0000000000000001, 0x000000010837002E).
also when i looked in the Header file:

Code: Select all

#ifdef NPTRACKINGTOOLS_EXPORTS
#define TTAPI __declspec(dllexport)
#else
#ifndef STATIC_TT_LINK
#define TTAPI __declspec(dllimport)
#else
#define TTAPI  
#endif
#endif

TTAPI   NPRESULT TT_FinalCleanup();

saverill24
Posts: 5
Joined: Wed May 20, 2015 5:28 am

Re: Tracking Tools access violation exception

Post by saverill24 »

I have a what appears to be the same or similar issue as the original poster however with slightly different circumstances. I am using LabVIEW 2014 and the Tracking Tool .dll that remain inside Motive (the new name for tracking tools). When I press stop there is some sort of error when calling the shutdown function in the .dll. When I close a .vi that was running the connection to Motive (the cameras, markers, and rigid bodies as well as other miscellaneous data come through great while its running) LabVIEW crashes with an 0xC0000005 Access Violation error. Which from what I have founds seems to be a pretty broad error, but I am not sure. Any help figuring out the exact source of this error (obviously something to do with closing/stopping the program) would be greatly appreciated.
steven.andrews
NaturalPoint Employee
NaturalPoint Employee
Posts: 738
Joined: Mon Jan 19, 2015 11:52 am

Re: Tracking Tools access violation exception

Post by steven.andrews »

Hello saverill24,

Thank you for reaching out to us regarding your crashes. It would help us if we could view the code you are running that is causing the crash.

Could you please open a ticket with us at help.naturalpoint.com ? Here, you can submit your code to us so we can troubleshoot this issue and track our progress.

Best regards,
Steven
--
Steven Andrews
OptiTrack | Customer Support Engineer
Post Reply