LoadProject stack overflow

Post Reply
jmckisson
Posts: 7
Joined: Tue Apr 30, 2013 9:14 am

LoadProject stack overflow

Post by jmckisson » Mon May 06, 2013 9:56 am

I am attempting to run the TT API thru a Java Native Interface wrapper but have run into a strange issue with the Load Project/Calibration/Trackables calls. Any call to them thru JNI results in a non-debuggable stack overflow exception and the only information regarding this is dumped by java into a log file (below)�

Also attached is the JNI code that calls these functions, it demonstrates a successful call to TT_Initialize as well as several other API calls. All 3 test cases crash immediately upon calling LoadWhatever with a valid path to the files exported by Motive.

At first I thought it was a problem with the string encoding, however hard coding the project name into LoadProject directly in native yields the same crash.
I have also noticed that Motive similarly crashes when attempting to change the name of a Rigid Body, so perhaps it is still related to some kind of string issue.

One important thing to note is compiling my test program into a native exe, all of this works properly with no crashes. However LoadProject will return error 3 (Failed) if passed anything other than a file in the current working directory.

Update:
I just updated to the latest build of Java 1.6 and now function names inside NPTrackingTools.dll are shown. The call stack crashes while in some NatNet Broadcast call (I don't use NatNet at all), so maybe it has nothing at all to do with what I was talking about above...

The calling code:

Code: Select all

int result = TT_Initialize();

if (result != NPRESULT_SUCCESS)
	return result;

int cCount = TT_CameraCount();
for (int i = 0; i < cCount; i++) {
	char buf[128];
	sprintf_s(buf, "Cam #%d [%s], %d markers\n", i, TT_CameraName(i), TT_CameraMarkerCount(i));
	std::cout << buf << std::endl;
}

const char *strChars = env->GetStringUTFChars(path, NULL);
if (env->ExceptionCheck()) {
	return -100;
}

std::cout << "Thread: " << std::this_thread::get_id() << std::endl;

switch (testCase) {
	case 0: 
		result = TT_LoadProject(strChars);
		break;
	case 1:
		result = TT_LoadCalibration(strChars);
		break;
	case 2:
		result = TT_LoadTrackables(strChars);

}

env->ReleaseStringUTFChars(path, strChars);

return result;

Code: Select all

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_STACK_OVERFLOW (0xc00000fd) at pc=0x50a445e7, pid=3624, tid=1012
#
# JRE version: 6.0_45-b06
# Java VM: Java HotSpot(TM) Client VM (20.45-b01 mixed mode windows-x86 )
# Problematic frame:
# C  [NPTrackingTools.dll+0x2045e7]
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  T H R E A D  ---------------

Current thread (0x0028a000):  JavaThread "main" [_thread_in_native, id=1012, stack(0x00290000,0x002e0000)]

siginfo: ExceptionCode=0xc00000fd, ExceptionInformation=0x00000000 0x00290000 

Registers:
EAX=0x00290000, EBX=0x13c8f710, ECX=0x0026edf8, EDX=0x002dfa3c
ESP=0x002df6a0, EBP=0x002df6b4, ESI=0x002df954, EDI=0x002df6c0
EIP=0x50a445e7, EFLAGS=0x00210206

Top of Stack: (sp=0x002df6a0)
0x002df6a0:   188e8710 50c11a7b 002dfa14 50c27c33
0x002df6b0:   ffffffff 002dfa20 50c1204a 002dfa3c
0x002df6c0:   61ca9afc 002dfc68 002dfacc 00140000
0x002df6d0:   1f220020 188e8710 00000000 000b0000
0x002df6e0:   00000000 002df788 1f220020 1f220020
0x002df6f0:   00140150 753d5b4c 00140000 00140150
0x002df700:   00000000 00000000 00140150 02000002
0x002df710:   00000000 9c00009c 0000007d 00000000 

Instructions: (pc=0x50a445e7)
0x50a445c7:   1b c0 f7 d0 23 c8 8b c4 25 00 f0 ff ff 3b c8 72
0x50a445d7:   0a 8b c1 59 94 8b 00 89 04 24 c3 2d 00 10 00 00
0x50a445e7:   85 00 eb e9 8b ff 55 8b ec 68 ac 7d 35 51 ff 15
0x50a445f7:   34 e1 c2 50 85 c0 74 15 68 9c 7d 35 51 50 ff 15 


Register to memory mapping:

EAX=0x00290000 is an unknown value
EBX=0x13c8f710 is an oop
{method} 
 - klass: {other class}
ECX=0x0026edf8 is an unknown value
EDX=0x002dfa3c is pointing into the stack for thread: 0x0028a000
ESP=0x002df6a0 is pointing into the stack for thread: 0x0028a000
EBP=0x002df6b4 is pointing into the stack for thread: 0x0028a000
ESI=0x002df954 is pointing into the stack for thread: 0x0028a000
EDI=0x002df6c0 is pointing into the stack for thread: 0x0028a000


Stack: [0x00290000,0x002e0000],  sp=0x002df6a0,  free space=317k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [NPTrackingTools.dll+0x2045e7]  NatNetHelper::Broadcast+0xcd17
C  [NPTrackingTools.dll+0x3d204a]  TT_Initialize+0x4a4ea
C  [NPTrackingTools.dll+0x3d22f8]  TT_Initialize+0x4a798
C  [NPTrackingTools.dll+0x3879b1]  TT_LoadProject+0x51
C  [JNITest.dll+0x18238]  Java_org_jlab_AwakeSPECT_Tracker_JNITest_n_1LoadProject+0x198
j  org.jlab.AwakeSPECT.Tracker.JNITest.n_LoadProject(ILjava/lang/String;)I+0
j  org.jlab.AwakeSPECT.Tracker.JNITest.main([Ljava/lang/String;)V+5
v  ~StubRoutines::call_stub
V  [jvm.dll+0xfb88b]
V  [jvm.dll+0x18d551]
V  [jvm.dll+0xfb90d]
V  [jvm.dll+0x960f6]
V  [jvm.dll+0x9e038]
V  [jvm.dll+0xafaeb]
C  [java.exe+0x2155]
C  [java.exe+0x85b4]
C  [kernel32.dll+0x4ed6c]  BaseThreadInitThunk+0x12
C  [ntdll.dll+0x6377b]  RtlInitializeExceptionChain+0xef
C  [ntdll.dll+0x6374e]  RtlInitializeExceptionChain+0xc2

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.jlab.AwakeSPECT.Tracker.JNITest.n_LoadProject(ILjava/lang/String;)I+0
j  org.jlab.AwakeSPECT.Tracker.JNITest.main([Ljava/lang/String;)V+5
v  ~StubRoutines::call_stub

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x01aa7000 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=5616, stack(0x17ea0000,0x17ef0000)]
  0x01aa4800 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=4300, stack(0x17e50000,0x17ea0000)]
  0x01a96000 JavaThread "JDWP Command Reader" daemon [_thread_in_native, id=5932, stack(0x17e00000,0x17e50000)]
  0x01a95000 JavaThread "JDWP Event Helper Thread" daemon [_thread_blocked, id=4652, stack(0x17db0000,0x17e00000)]
  0x01a93000 JavaThread "JDWP Transport Listener: dt_shmem" daemon [_thread_blocked, id=5936, stack(0x17d60000,0x17db0000)]
  0x01a89400 JavaThread "Attach Listener" daemon [_thread_blocked, id=4132, stack(0x17d10000,0x17d60000)]
  0x01a86000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=3796, stack(0x17cc0000,0x17d10000)]
  0x01a4e000 JavaThread "Finalizer" daemon [_thread_blocked, id=6092, stack(0x17c70000,0x17cc0000)]
  0x01a4cc00 JavaThread "Reference Handler" daemon [_thread_blocked, id=5628, stack(0x17c20000,0x17c70000)]
=>0x0028a000 JavaThread "main" [_thread_in_native, id=1012, stack(0x00290000,0x002e0000)]

Other Threads:
  0x01a48000 VMThread [stack: 0x17bd0000,0x17c20000] [id=4892]
  0x01abd000 WatcherThread [stack: 0x180f0000,0x18140000] [id=4484]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 def new generation   total 19648K, used 1048K [0x03ac0000, 0x05010000, 0x09010000)
  eden space 17472K,   6% used [0x03ac0000, 0x03bc61f8, 0x04bd0000)
  from space 2176K,   0% used [0x04bd0000, 0x04bd0000, 0x04df0000)
  to   space 2176K,   0% used [0x04df0000, 0x04df0000, 0x05010000)
 tenured generation   total 43712K, used 0K [0x09010000, 0x0bac0000, 0x13ac0000)
   the space 43712K,   0% used [0x09010000, 0x09010000, 0x09010200, 0x0bac0000)
 compacting perm gen  total 12288K, used 1854K [0x13ac0000, 0x146c0000, 0x17ac0000)
   the space 12288K,  15% used [0x13ac0000, 0x13c8fbf0, 0x13c8fc00, 0x146c0000)
No shared spaces configured.

Code Cache  [0x01ac0000, 0x01b38000, 0x03ac0000)
 total_blobs=139 nmethods=22 adapters=62 free_code_cache=33071040 largest_free_block=0

Dynamic libraries:
0x00400000 - 0x00425000 	C:\Program Files\Java\jdk1.6.0_45\bin\java.exe
0x77150000 - 0x7728c000 	C:\Windows\SYSTEM32\ntdll.dll
0x757c0000 - 0x75894000 	C:\Windows\system32\kernel32.dll
0x75390000 - 0x753db000 	C:\Windows\system32\KERNELBASE.dll
0x759c0000 - 0x75a60000 	C:\Windows\system32\ADVAPI32.dll
0x772d0000 - 0x7737c000 	C:\Windows\system32\msvcrt.dll
0x759a0000 - 0x759b9000 	C:\Windows\SYSTEM32\sechost.dll
0x76860000 - 0x76901000 	C:\Windows\system32\RPCRT4.dll
0x7c340000 - 0x7c396000 	C:\Program Files\Java\jdk1.6.0_45\jre\bin\msvcr71.dll
0x6d8e0000 - 0x6db90000 	C:\Program Files\Java\jdk1.6.0_45\jre\bin\client\jvm.dll
0x76a80000 - 0x76b49000 	C:\Windows\system32\USER32.dll
0x76a30000 - 0x76a7e000 	C:\Windows\system32\GDI32.dll
0x772a0000 - 0x772aa000 	C:\Windows\system32\LPK.dll
0x75a60000 - 0x75afd000 	C:\Windows\system32\USP10.dll
0x73620000 - 0x73652000 	C:\Windows\system32\WINMM.dll
0x772b0000 - 0x772cf000 	C:\Windows\system32\IMM32.DLL
0x76db0000 - 0x76e7c000 	C:\Windows\system32\MSCTF.dll
0x75210000 - 0x7525c000 	C:\Windows\system32\apphelp.dll
0x6d890000 - 0x6d89c000 	C:\Program Files\Java\jdk1.6.0_45\jre\bin\verify.dll
0x6d3e0000 - 0x6d3ff000 	C:\Program Files\Java\jdk1.6.0_45\jre\bin\java.dll
0x6d430000 - 0x6d459000 	C:\Program Files\Java\jdk1.6.0_45\jre\bin\jdwp.dll
0x6d750000 - 0x6d756000 	C:\Program Files\Java\jdk1.6.0_45\jre\bin\npt.dll
0x6d8d0000 - 0x6d8df000 	C:\Program Files\Java\jdk1.6.0_45\jre\bin\zip.dll
0x6d2a0000 - 0x6d2a8000 	C:\Program Files\Java\jdk1.6.0_45\jre\bin\dt_shmem.dll
0x58080000 - 0x580a5000 	C:\Users\john\Documents\Visual Studio 2010\Projects\AwakeSPECT\Debug\JNITest.dll
0x50840000 - 0x5142c000 	C:\Users\john\IdeaProjects\AwakeSPECTControl\NPTrackingTools.dll
0x55140000 - 0x55208000 	C:\Windows\system32\OPENGL32.dll
0x72cd0000 - 0x72cf2000 	C:\Windows\system32\GLU32.dll
0x559e0000 - 0x55ac7000 	C:\Windows\system32\DDRAW.dll
0x740f0000 - 0x740f6000 	C:\Windows\system32\DCIMAN32.dll
0x755e0000 - 0x7577d000 	C:\Windows\system32\SETUPAPI.dll
0x755b0000 - 0x755d7000 	C:\Windows\system32\CFGMGR32.dll
0x75900000 - 0x7598f000 	C:\Windows\system32\OLEAUT32.dll
0x76ff0000 - 0x7714c000 	C:\Windows\system32\ole32.dll
0x75590000 - 0x755a2000 	C:\Windows\system32\DEVOBJ.dll
0x73c50000 - 0x73c63000 	C:\Windows\system32\dwmapi.dll
0x75780000 - 0x757b5000 	C:\Windows\system32\WS2_32.dll
0x76b50000 - 0x76b56000 	C:\Windows\system32\NSI.dll
0x75b00000 - 0x7674a000 	C:\Windows\system32\SHELL32.dll
0x767d0000 - 0x76827000 	C:\Windows\system32\SHLWAPI.dll
0x74900000 - 0x74907000 	C:\Windows\system32\WSOCK32.dll
0x73270000 - 0x7328c000 	C:\Windows\system32\IPHLPAPI.DLL
0x73260000 - 0x73267000 	C:\Windows\system32\WINNSI.DLL
0x692d0000 - 0x692d9000 	C:\Windows\system32\snmpapi.dll
0x73920000 - 0x7392d000 	C:\Windows\system32\VCOMP100.DLL
0x55070000 - 0x5513b000 	C:\Windows\system32\MSVCP110D.dll
0x541e0000 - 0x54381000 	C:\Windows\system32\MSVCR110D.dll
0x752e0000 - 0x752eb000 	C:\Windows\system32\profapi.dll
0x73780000 - 0x73790000 	C:\Windows\system32\NLAapi.dll
0x73f80000 - 0x73fc0000 	C:\Windows\system32\uxtheme.dll
0x70b60000 - 0x70b70000 	C:\Windows\system32\napinsp.dll
0x70b40000 - 0x70b52000 	C:\Windows\system32\pnrpnsp.dll
0x70b10000 - 0x70b37000 	C:\Program Files\Common Files\Microsoft Shared\Windows Live\WLIDNSP.DLL
0x77290000 - 0x77295000 	C:\Windows\system32\PSAPI.DLL
0x74d00000 - 0x74d3c000 	C:\Windows\System32\mswsock.dll
0x74bd0000 - 0x74c14000 	C:\Windows\system32\DNSAPI.dll
0x70a80000 - 0x70a88000 	C:\Windows\System32\winrnr.dll
0x63560000 - 0x63568000 	C:\Program Files\National Instruments\Shared\mDNS Responder\nimdnsNSP.dll
0x63550000 - 0x6355b000 	C:\Windows\system32\nimdnsResponder.dll
0x70b90000 - 0x70c33000 	C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.5054_none_509208cabcb9216b\MSVCR90.dll
0x72de0000 - 0x72e18000 	C:\Windows\System32\fwpuclnt.dll
0x70b00000 - 0x70b06000 	C:\Windows\system32\rasadhlp.dll
0x72e20000 - 0x72e32000 	C:\Windows\system32\dhcpcsvc.DLL
0x73370000 - 0x7337f000 	C:\Windows\system32\inetmib1.dll
0x74700000 - 0x74705000 	C:\Windows\System32\wshtcpip.dll

VM Arguments:
jvm_args: -agentlib:jdwp=transport=dt_shmem,address=javadebug,suspend=y,server=n
-Djava.library.path=C:\Users\john\Documents\Visual Studio 2010\Projects\AwakeSPECT\Debug -Xms64m -Xcheck:jni -verbose:jni -Dfile.encoding=UTF-8 
java_command: org.jlab.AwakeSPECT.Tracker.JNITest
Launcher Type: SUN_STANDARD

Environment Variables:
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_45
PATH=<way too long>
USERNAME=john
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 6 Model 23 Stepping 10, GenuineIntel



---------------  S Y S T E M  ---------------

OS: Windows 7 Build 7601 Service Pack 1

CPU:total 2 (2 cores per cpu, 1 threads per core) family 6 model 23 stepping 10, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1

Memory: 4k page, physical 3108504k(1085604k free), swap 6215256k(3975000k free)

vm_info: Java HotSpot(TM) Client VM (20.45-b01) for windows-x86 JRE (1.6.0_45-b06), built on Mar 26 2013 13:40:03 by "java_re" with MS VC++ 7.1 (VS2003)

time: Mon May 06 12:22:34 2013
elapsed time: 3 seconds

jmckisson
Posts: 7
Joined: Tue Apr 30, 2013 9:14 am

Re: LoadProject stack overflow

Post by jmckisson » Tue May 07, 2013 12:52 pm

Just submitted an official support ticket for this...

NaturalPoint-Dustin
Posts: 612
Joined: Tue Mar 19, 2013 5:03 pm

Re: LoadProject stack overflow

Post by NaturalPoint-Dustin » Tue May 07, 2013 1:08 pm

Thanks for submitting a ticket. I will do some research and get back to you on this as soon as possible.
Dustin
Technical Support Engineer
OptiTrack | TrackIR | SmartNav

Post Reply