OpenNI2 icon indicating copy to clipboard operation
OpenNI2 copied to clipboard

NiViewer segfaults when compiled with -O2

Open jeadorf opened this issue 11 years ago • 1 comments

When setting the stream to a certain frame (using the ":" shortcut on the keyboard), the NiViewer segfaults. My own code using the seek method in openni::PlaybackControl segfaults as well.

I can reliably reproduce the segmentation fault: it appears when OpenNI2 is compiled with optimization turned on (-O2, i.e. Release mode). Everything works fine when compiling OpenNI2 with optimization disabled (-O0, i.e. Debug mode).

  • OpenNI2: commit 5b88c95e4f8d19b95713e3c873c7d07e48e5605b
  • g++ (GCC) 4.8.1 20130725 (prerelease)
  • Linux 3.11.4-1-ARCH x86_64 GNU/Linux

I tried the following configurations:

  • works: CFLAGS += -O0 -DNDEBUG
  • segfaults: CFLAGS += -DNDEBUG
  • segfaults: CFLAGS += -O2
  • segfaults: CFLAGS += -O2 -DNDEBUG
  • segfaults: CFLAGS += -O2 -DNDEBUG
  • segfaults: CFLAGS += -g -O2

Unfortunately, the stacktrace in GNU debugger did not tell me very much even though I compiled with the debug symbols enabled:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffeb501700 (LWP 662)]
0x00007ffff22eb230 in ?? () from /usr/lib/OpenNI2/Drivers/libOniFile.so
(gdb) bt
#0  0x00007ffff22eb230 in ?? () from /usr/lib/OpenNI2/Drivers/libOniFile.so
#1  0x00007ffff22f01e7 in ?? () from /usr/lib/OpenNI2/Drivers/libOniFile.so
#2  0x00007ffff22f0289 in ?? () from /usr/lib/OpenNI2/Drivers/libOniFile.so
#3  0x00007ffff73cf0a2 in start_thread () from /usr/lib/libpthread.so.0
#4  0x00007ffff68e443d in clone () from /usr/lib/libc.so.6

jeadorf avatar Oct 13 '13 21:10 jeadorf

Hi,

Can you test with current 'develop' branch? If yes, does it happen with any recording or only a specific one? Which frame index are you seeking to?

eddiecohen avatar Nov 03 '13 15:11 eddiecohen