sarxos / webcam-capture

The goal of this project is to allow integrated or USB-connected webcams to be accessed directly from Java. Using provided libraries users are able to read camera images and detect motion. Main project consist of several sub projects - the root one, which contains required classes, build-in webcam driver compatible with Windows, Linux and Mac OS, which can stream images as fast as your camera can serve them (up to 50 FPS). Main project can be used standalone, but user is able to replace build-in driver with different one - such as OpenIMAJ, GStreamer, V4L4j, JMF, LTI-CIVIL, FMJ, etc.
http://webcam-capture.sarxos.pl
MIT License
2.28k stars 1.11k forks source link

JVM crash with Point Grey Webcam #326

Open nbouche opened 9 years ago

nbouche commented 9 years ago

Hello, Under windows 7 with java 1.7, the capture works perfectly with my integrated webcam, but with the 4K point grey webcam (FL3-U3-88S2C-C: 4096x2160 @21 FPS) a JVM crash occurs ! the Java code:

        List<Webcam> webcams = Webcam.getWebcams();

        Webcam webcam = null;
        for (Webcam cam : webcams) {
            System.out.println(cam.getName());
            if (cam.getName().contains("Point Grey Camera")){
                webcam = cam;
            }
        }

        Dimension[] nonStandardResolutions = new Dimension[] {
            WebcamResolution.UHD.getSize()};

        webcam.setCustomViewSizes(nonStandardResolutions);
        webcam.setViewSize(WebcamResolution.UHD.getSize());
        webcam.open();

logs:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_UNCAUGHT_CXX_EXCEPTION (0xe06d7363) at pc=0x000007fefd69940d, pid=5288, tid=3436
#
# JRE version: Java(TM) SE Runtime Environment (7.0_75-b13) (build 1.7.0_75-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.75-b04 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [KERNELBASE.dll+0x940d]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/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 (0x0000000010ace800):  JavaThread "atomic-processor-1" daemon [_thread_in_native, id=3436, stack(0x00000000126c0000,0x00000000127c0000)]

siginfo: ExceptionCode=0xe06d7363, ExceptionInformation=0x0000000019930520 0x00000000127bed70 0x000007fee846ac50 0x000007fee8440000 

Registers:
RAX=0x000000006535cc76, RBX=0x00000000127bed70, RCX=0x00000000127be600, RDX=0x00000000000000d0
RSP=0x00000000127bec10, RBP=0x00000000127bed40, RSI=0x00000000136de018, RDI=0x000007fee846ac50
R8 =0x0000000000000000, R9 =0x0000000000000000, R10=0x000007fee8440000, R11=0x00000000127bec50
R12=0x0000000011e15cc0, R13=0x00000000127bf130, R14=0x00000000127bf130, R15=0x00000000127bf268
RIP=0x000007fefd69940d, EFLAGS=0x0000000000000202

Top of Stack: (sp=0x00000000127bec10)
0x00000000127bec10:   00000000127bed70 00000000136de018
0x00000000127bec20:   000007fee846ac50 0000000180379aa5
0x00000000127bec30:   00000001e06d7363 0000000000000000
0x00000000127bec40:   000007fefd69940d 000007fe00000004
0x00000000127bec50:   0000000019930520 00000000127bed70
0x00000000127bec60:   000007fee846ac50 000007fee8440000
0x00000000127bec70:   0000000000000000 00000000127becf8
0x00000000127bec80:   00000000127bef10 00000000136de018
0x00000000127bec90:   000000000037cad0 00000000778e3c2a
0x00000000127beca0:   0000000011e15cc0 00000000127bf130
0x00000000127becb0:   00000000127bf130 00000000127bf130
0x00000000127becc0:   0000000011e15cc0 000007fee846ac50
0x00000000127becd0:   00000000136de018 000007fee844fde9
0x00000000127bece0:   00000000127bed70 00000000127bed50
0x00000000127becf0:   ffffffff00000001 000007fee84400f8
0x00000000127bed00:   00000001e06d7363 0000000000000000 

Instructions: (pc=0x000007fefd69940d)
0x000007fefd6993ed:   54 24 24 48 89 4c 24 28 4d 85 c9 0f 85 aa 18 00
0x000007fefd6993fd:   00 89 4c 24 38 48 8d 4c 24 20 ff 15 93 1e 04 00
0x000007fefd69940d:   48 81 c4 c8 00 00 00 c3 90 90 90 90 90 90 90 90
0x000007fefd69941d:   90 90 90 48 8b c4 48 83 ec 78 41 f7 c0 fe ff ff 

Register to memory mapping:

RAX=0x000000006535cc76 is an unknown value
RBX=0x00000000127bed70 is pointing into the stack for thread: 0x0000000010ace800
RCX=0x00000000127be600 is pointing into the stack for thread: 0x0000000010ace800
RDX=0x00000000000000d0 is an unknown value
RSP=0x00000000127bec10 is pointing into the stack for thread: 0x0000000010ace800
RBP=0x00000000127bed40 is pointing into the stack for thread: 0x0000000010ace800
RSI=0x00000000136de018 is an unknown value
RDI=0x000007fee846ac50 is an unknown value
R8 =0x0000000000000000 is an unknown value
R9 =0x0000000000000000 is an unknown value
R10=0x000007fee8440000 is an unknown value
R11=0x00000000127bec50 is pointing into the stack for thread: 0x0000000010ace800
R12=0x0000000011e15cc0 is an unknown value
R13=0x00000000127bf130 is pointing into the stack for thread: 0x0000000010ace800
R14=0x00000000127bf130 is pointing into the stack for thread: 0x0000000010ace800
R15=0x00000000127bf268 is pointing into the stack for thread: 0x0000000010ace800

Stack: [0x00000000126c0000,0x00000000127c0000],  sp=0x00000000127bec10,  free space=1019k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [KERNELBASE.dll+0x940d]
C  [OpenIMAJGrabber.dll+0xe84e]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.startSession(IIDLorg/bridj/Pointer;)Z+0
j  com.github.sarxos.webcam.ds.buildin.WebcamDefaultDevice.open()V+178
j  com.github.sarxos.webcam.ds.cgt.WebcamOpenTask.handle()V+55
j  com.github.sarxos.webcam.WebcamProcessor$AtomicProcessor.run()V+14
j  java.util.concurrent.ThreadPoolExecutor.runWorker(Ljava/util/concurrent/ThreadPoolExecutor$Worker;)V+95
j  java.util.concurrent.ThreadPoolExecutor$Worker.run()V+5
j  java.lang.Thread.run()V+11
v  ~StubRoutines::call_stub

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

Java Threads: ( => current thread )
  0x0000000010c84000 JavaThread "webcam-lock-[Point Grey Camera 1]" daemon [_thread_blocked, id=5244, stack(0x0000000013b80000,0x0000000013c80000)]
  0x0000000012d19800 JavaThread "webcam-discovery-service" daemon [_thread_blocked, id=6148, stack(0x0000000013930000,0x0000000013a30000)]
=>0x0000000010ace800 JavaThread "atomic-processor-1" daemon [_thread_in_native, id=3436, stack(0x00000000126c0000,0x00000000127c0000)]
  0x00000000109b3000 JavaThread "Service Thread" daemon [_thread_blocked, id=3364, stack(0x00000000123a0000,0x00000000124a0000)]
  0x00000000109ac800 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=6424, stack(0x0000000012250000,0x0000000012350000)]
  0x000000000fa1d800 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=3416, stack(0x00000000120d0000,0x00000000121d0000)]
  0x000000000fa1c800 JavaThread "Attach Listener" daemon [_thread_blocked, id=6304, stack(0x0000000011f40000,0x0000000012040000)]
  0x000000000fa1c000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=3784, stack(0x0000000011e30000,0x0000000011f30000)]
  0x0000000001d4f000 JavaThread "Finalizer" daemon [_thread_blocked, id=3544, stack(0x0000000011c20000,0x0000000011d20000)]
  0x0000000001d48000 JavaThread "Reference Handler" daemon [_thread_blocked, id=6592, stack(0x0000000011a80000,0x0000000011b80000)]
  0x0000000001cb8000 JavaThread "main" [_thread_blocked, id=6584, stack(0x0000000002540000,0x0000000002640000)]

Other Threads:
  0x000000000f9fd000 VMThread [stack: 0x0000000011920000,0x0000000011a20000] [id=6200]
  0x00000000109c5800 WatcherThread [stack: 0x0000000012500000,0x0000000012600000] [id=6864]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 PSYoungGen      total 76288K, used 10615K [0x00000007ab200000, 0x00000007b0700000, 0x0000000800000000)
  eden space 65536K, 16% used [0x00000007ab200000,0x00000007abc5df60,0x00000007af200000)
  from space 10752K, 0% used [0x00000007afc80000,0x00000007afc80000,0x00000007b0700000)
  to   space 10752K, 0% used [0x00000007af200000,0x00000007af200000,0x00000007afc80000)
 ParOldGen       total 173568K, used 0K [0x0000000701600000, 0x000000070bf80000, 0x00000007ab200000)
  object space 173568K, 0% used [0x0000000701600000,0x0000000701600000,0x000000070bf80000)
 PSPermGen       total 21504K, used 6222K [0x00000006fc400000, 0x00000006fd900000, 0x0000000701600000)
  object space 21504K, 28% used [0x00000006fc400000,0x00000006fca138a8,0x00000006fd900000)

Card table byte_map: [0x0000000005640000,0x0000000005e60000] byte_map_base: 0x0000000001e5e000

Polling page: 0x0000000001d50000

Code Cache  [0x0000000002640000, 0x00000000028b0000, 0x0000000005640000)
 total_blobs=275 nmethods=25 adapters=203 free_code_cache=48690Kb largest_free_block=49845056

Compilation events (10 events):
Event: 0.342 Thread 0x00000000109ac800 nmethod 21 0x00000000026ae550 code [0x00000000026ae6a0, 0x00000000026ae858]
Event: 0.346 Thread 0x000000000fa1d800 nmethod 17 0x00000000026af750 code [0x00000000026af8c0, 0x00000000026b0568]
Event: 0.361 Thread 0x00000000109ac800   22             sun.net.www.ParseUtil::encodePath (336 bytes)
Event: 0.362 Thread 0x000000000fa1d800   23             sun.nio.cs.UTF_8$Encoder::encode (361 bytes)
Event: 0.367 Thread 0x000000000fa1d800 nmethod 23 0x00000000026adc10 code [0x00000000026add60, 0x00000000026ae248]
Event: 0.379 Thread 0x00000000109ac800 nmethod 22 0x00000000026b0fd0 code [0x00000000026b1200, 0x00000000026b23e8]
Event: 0.411 Thread 0x000000000fa1d800   24             java.io.ByteArrayOutputStream::ensureCapacity (16 bytes)
Event: 0.411 Thread 0x000000000fa1d800 nmethod 24 0x00000000026b2e90 code [0x00000000026b2fe0, 0x00000000026b3088]
Event: 0.420 Thread 0x00000000109ac800   25             java.util.HashMap::indexFor (6 bytes)
Event: 0.421 Thread 0x00000000109ac800 nmethod 25 0x000000000269fb10 code [0x000000000269fc40, 0x000000000269fc78]

GC Heap History (0 events):
No events

Deoptimization events (2 events):
Event: 0.371 Thread 0x0000000010ace800 Uncommon trap: reason=class_check action=maybe_recompile pc=0x00000000026ad5b8 method=java.lang.String.equals(Ljava/lang/Object;)Z @ 8
Event: 0.426 Thread 0x0000000010ace800 Uncommon trap: reason=class_check action=maybe_recompile pc=0x00000000026a4cf4 method=java.util.Properties$LineReader.readLine()I @ 62

Internal exceptions (10 events):
Event: 0.431 Thread 0x0000000001cb8000 Threw 0x00000007ab2dd8e8 at C:\re\jdk7u75\1940\hotspot\src\share\vm\prims\jvm.cpp:1281
Event: 0.431 Thread 0x0000000001cb8000 Threw 0x00000007ab2e4c48 at C:\re\jdk7u75\1940\hotspot\src\share\vm\prims\jvm.cpp:1281
Event: 0.432 Thread 0x0000000001cb8000 Threw 0x00000007ab2e8750 at C:\re\jdk7u75\1940\hotspot\src\share\vm\prims\jvm.cpp:1281
Event: 0.435 Thread 0x0000000012d19800 Threw 0x00000007ab9cf460 at C:\re\jdk7u75\1940\hotspot\src\share\vm\prims\jvm.cpp:1281
Event: 0.436 Thread 0x0000000012d19800 Threw 0x00000007ab9d5158 at C:\re\jdk7u75\1940\hotspot\src\share\vm\prims\jvm.cpp:1281
Event: 0.436 Thread 0x0000000012d19800 Threw 0x00000007ab9d6818 at C:\re\jdk7u75\1940\hotspot\src\share\vm\prims\jvm.cpp:1281
Event: 0.437 Thread 0x0000000001cb8000 Threw 0x00000007ab2eba30 at C:\re\jdk7u75\1940\hotspot\src\share\vm\prims\jvm.cpp:1281
Event: 0.437 Thread 0x0000000001cb8000 Threw 0x00000007ab2ecfb0 at C:\re\jdk7u75\1940\hotspot\src\share\vm\prims\jvm.cpp:1281
Event: 0.438 Thread 0x0000000001cb8000 Threw 0x00000007ab2eed00 at C:\re\jdk7u75\1940\hotspot\src\share\vm\prims\jvm.cpp:1281
Event: 0.442 Thread 0x0000000001cb8000 Threw 0x00000007ab2f29d8 at C:\re\jdk7u75\1940\hotspot\src\share\vm\prims\jvm.cpp:1281

Events (10 events):
Event: 0.437 loading class 0x0000000010c1a5d0
Event: 0.437 loading class 0x0000000010c1a5d0 done
Event: 0.437 loading class 0x0000000012d38db0
Event: 0.438 loading class 0x0000000012d38db0 done
Event: 0.438 Thread 0x0000000012d19800 Thread added: 0x0000000012d19800
Event: 0.438 loading class 0x0000000012d72d80
Event: 0.438 loading class 0x0000000012d72d80 done
Event: 0.442 Thread 0x0000000010c84000 Thread added: 0x0000000010c84000
Event: 0.442 loading class 0x0000000012d72dd0
Event: 0.442 loading class 0x0000000012d72dd0 done

Dynamic libraries:
0x000000013f710000 - 0x000000013f743000     C:\Program Files\Java\jdk1.7.0_75\jre\bin\javaw.exe
sarxos commented 9 years ago

Hi @nbouche,

Thank you for the bug report.

Seems like the issue in OpenIMAJGrabber natives. @jonhare, you may be interested in this.