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.27k stars 1.11k forks source link

java.util.concurrent.RejectedExecutionException and JVM crashes sometimes #228

Open kaustubhasgudi opened 10 years ago

kaustubhasgudi commented 10 years ago

Hello

I receive this exception from webcam-capture library :

WebcamExceptionHandler           Exception in thread webcam-updater-thread-1
java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@7e3d261c rejected from java.util.concurrent.ScheduledThreadPoolExecutor@60913903[Shutting down, pool size = 1, active threads = 1, queued tasks = 0, completed tasks = 106]
        at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.reject(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor.schedule(Unknown Source)
        at java.util.concurrent.Executors$DelegatedScheduledExecutorService.schedule(Unknown Source)
        at com.github.sarxos.webcam.WebcamUpdater.tick(WebcamUpdater.java:237)
        at com.github.sarxos.webcam.WebcamUpdater.run(WebcamUpdater.java:192)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

Environment Details : Windows 7 Professional SP1 x64 JDK 1.7.0_45 x64 WebCam : Lenovo Think Advantage webcam for Lenovo Thinkpad T430

Libraries : bridj-0.7-20131007.003529-54.jar webcam-capture-0.3.10-RC6

Given below is the code for webcam capture :


   defaultWebcam.setViewSize(size);
   if (defaultWebcam.isOpen()) {
    defaultWebcam.close();
   }

   int i = 0;
   do {
    if (defaultWebcam.getLock().isLocked()) {
     LOGGER.debug(String.format("Unlocking webcam: %d", i));
     defaultWebcam.getLock().unlock();
     Thread.sleep(2000);
    } else {
     break;
    }
   } while (i++ < 3);
   this.captureWebcamImage(defaultWebcam, delay);
  } finally {
   if (defaultWebcam != null) {
    defaultWebcam.close();
    defaultWebcam.getLock().unlock();
   }
  }

 private void captureWebcamImage(Webcam defaultWebcam,int delay) throws InterruptedException, WebcamException, IOException{
  LOGGER.debug("Opening webcam...");
  defaultWebcam.open();  

  WebcamDevice device = defaultWebcam.getDevice();
  LOGGER.info(String.format("Webcam device: %s", device.getName()));
  Dimension resolution = device.getResolution();
  LOGGER.info(String.format("Webcam current resolution: %dx%d",
    resolution.width, resolution.height));
  StringBuilder sb = new StringBuilder();
  for (Dimension r : device.getResolutions()) {
   if (sb.length() > 0) {
    sb.append(", ");
   }
   sb.append(String.format("%dx%d", r.width, r.height));
  }
  LOGGER.info(String.format("Webcam supported resolutions: %s", sb.toString()));
  if (delay > 0) {
   LOGGER.info(String.format("Waiting %d seconds...", delay));
   Thread.sleep(new Duration().seconds(delay).getTime());
  }
  final BufferedImage img = defaultWebcam.getImage();
  if (img == null) {
   throw new WebcamException("The webcam is not available.");
  }
  LOGGER.info(String.format("Taking a %dx%d image...", img.getWidth(), img.getHeight()));
  FileUtil.mkdirs(new File(WEBCAMSHOTS_DIR));
  final String imageName = WEBCAMSHOTS_DIR + File.separator  + WEBCAMSHOT_FILE_NAME;
  final File imageFile = new File(imageName);
  if (!imageFile.exists()) {
   LOGGER.debug(String.format("The image file does not exist, creating: %s", imageFile));
   if (!imageFile.createNewFile()) {
    throw new WebcamException("The image file cannot be created.");
   }
  }
  ImageIO.write(img, JPG, imageFile);
  ClientState state = ClientState.getInstance();
  state.setWebcamImage(img);
 }

 public File getWebcamImageFile() {
  return new File(WEBCAMSHOTS_DIR, WEBCAMSHOT_FILE_NAME);
 }

Most of the time the webcam capture process works fine but less often it show the above exception and sometimes the application silently exits (JVM crash). Please assist.

sarxos commented 10 years ago

Hi @kaustubhasgudi,

Do not modify the lock state unless you are completely aware of what you are doing. Especially on Windows. Locking has been designed to get rid of weird Microsoft issues with accessing DirectShow from two parallel contexts, which in some cases causes JVM to crash.

You do not also need to use webcam device because all the information you are getting from it are already available from webcam object.

Modified source code:

import java.awt.Dimension;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;

import javax.imageio.ImageIO;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.github.sarxos.webcam.Webcam;
import com.github.sarxos.webcam.WebcamException;
import com.github.sarxos.webcam.WebcamResolution;

public class X {

    private static final Logger LOGGER = LoggerFactory.getLogger(X.class);
    private static final String WEBCAMSHOTS_DIR = "./dir";
    private static final String WEBCAMSHOT_FILE_NAME = "test.jpg";

    public static void main(String[] args) {
        new X().capture();
    }

    private void capture() {

        int delay = 3; // 3 seconds, but you can set it to whatever you want
        Dimension size = WebcamResolution.VGA.getSize();
        Webcam defaultWebcam = Webcam.getDefault();

        if (defaultWebcam == null) {
            LOGGER.error("There is no webcam detected in the system");
            return;
        }

        try {
            defaultWebcam.setViewSize(size);
            defaultWebcam.open();
            captureWebcamImage(defaultWebcam, delay);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            defaultWebcam.close();
        }
    }

    private void captureWebcamImage(Webcam defaultWebcam, int delay) throws InterruptedException, WebcamException, IOException {

        Dimension resolution = defaultWebcam.getViewSize();
        Dimension[] resolutions = defaultWebcam.getViewSizes();

        LOGGER.info(String.format("Webcam device: %s", defaultWebcam.getName()));
        LOGGER.info(String.format("Webcam current resolution: %dx%d", resolution.width, resolution.height));

        StringBuilder sb = new StringBuilder();
        String delimiter = "";

        for (Dimension r : resolutions) {
            sb.append(delimiter).append(String.format("%dx%d", r.width, r.height));
            delimiter = ", ";
        }

        LOGGER.info(String.format("Webcam supported resolutions: %s", sb.toString()));

        if (delay > 0) {
            LOGGER.info(String.format("Waiting %d seconds...", delay));
            Thread.sleep(TimeUnit.MILLISECONDS.convert(delay, TimeUnit.SECONDS));
        }

        final BufferedImage img = defaultWebcam.getImage();
        if (img == null) {
            throw new WebcamException("The webcam is not available.");
        }

        LOGGER.info(String.format("Taking a %dx%d image...", img.getWidth(), img.getHeight()));
        new File(WEBCAMSHOTS_DIR).mkdir();
        final String imageName = WEBCAMSHOTS_DIR + File.separator + WEBCAMSHOT_FILE_NAME;
        final File imageFile = new File(imageName);
        if (!imageFile.exists()) {
            LOGGER.debug(String.format("The image file does not exist, creating: %s", imageFile));
            if (!imageFile.createNewFile()) {
                throw new WebcamException("The image file cannot be created.");
            }
        }
        ImageIO.write(img, "JPG", imageFile);

        ClientState.getInstance().setWebcamImage(img);
    }

    public File getWebcamImageFile() {
        return new File(WEBCAMSHOTS_DIR, WEBCAMSHOT_FILE_NAME);
    }
}

The exception you've observed is harmless and you can simply ignore it, but still I did small change in the source code which should get rid of it in the future.

Please donate to the project if you consider this information as useful.

sarxos commented 10 years ago

The JAR with this fix is available here:

https://oss.sonatype.org/content/repositories/snapshots/com/github/sarxos/webcam-capture/0.3.10-SNAPSHOT/webcam-capture-0.3.10-20140621.172322-31.jar

kaustubhasgudi commented 10 years ago

Hi @sarxos

Thanks for your quick reply. But removing lock/unlock didn't help. The tool still crashes and I am able to reproduce the crash myself. I have even tried to open the webcam in both synchronous and asynchronous modes using :

defaultWebcam.open();

and

defaultWebcam.open(true);

I even observed that once I try to test the webcam using a single call to webcam.getImage(), CPU raises to 25% and doesn't come down at all despite closing the webcam and releasing all resources. I'm not sure the CPU consumption is attributed to the above error but the JVM crash and CPU consumption are closely associated as it seems.

Can you suggest any workaround/solution for this ?

kaustubhasgudi commented 10 years ago

Oh. sorry. I missed the jar file update. I'll try it and get back .

sarxos commented 10 years ago

This is strange. Is it reproducible on other computers?

I had pretty similar situation in the past but it was caused by the fact that I was killing application simultaneously, without releasing resources. In such case, when I ran it again, I observed JVM crash and I had to restart Windows to get rid of this problem.

However, if the problem you are reporting is not directly caused by such application killing, I'm not sure of how to resolve it. I would suggest to test if this problem can be observed on other computers. It may be that some application/driver in the middle is causing this (e.g. some buggy DirectShow filter) and not the library itself.

When Java HotSpot crashes it drops hs_err_pid1234.log file in the working directory (where 1234 is a process ID). This log contains very usable info together with a failure stack trace. It will for sure help investigating what may be wrong.

sarxos commented 10 years ago

The JAR I uploaded is to fix this RejectExecutionException. I doubt it will fix JVM crash issue.

kaustubhasgudi commented 10 years ago

Hi @sarxos

Here is one such HotSpot Error Log file :

A fatal error has been detected by the Java Runtime Environment:
 EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000077323290, pid=14220, tid=13724
JRE version: Java(TM) SE Runtime Environment (7.0_45-b18) (build 1.7.0_45-b18)
Java VM: Java HotSpot(TM) 64-Bit Server VM (24.45-b08 mixed mode windows-amd64 compressed oops)
Problematic frame:
C  [ntdll.dll+0x53290]

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 (0x0000000008358000):  JavaThread "Finalizer" daemon [_thread_in_native, id=13724, stack(0x0000000009920000,0x0000000009a20000)]

siginfo: ExceptionCode=0xc0000005, reading address 0x0000000233be3ae8

Registers:
RAX=0x0000003700001388, RBX=0x0000000233be3ae0, RCX=0x000000ffffffffff, RDX=0x00000000108fa970
RSP=0x0000000009a1ec20, RBP=0x0000000000000000, RSI=0x00000000108f0000, RDI=0x00000000108fa980
R8 =0x00000000108fa980, R9 =0x00000000c5394fe0, R10=0x00000000026b3064, R11=0x000000006911f900
R12=0x0000000000000000, R13=0x00000000c11b0880, R14=0x0000000009a1edd8, R15=0x0000000008358000
RIP=0x0000000077323290, EFLAGS=0x0000000000010202

Top of Stack: (sp=0x0000000009a1ec20)
0x0000000009a1ec20:   000007fee4b619a0 0000000009a1ec28
0x0000000009a1ec30:   00000000bfe9ceb8 0000000009a1ec78
0x0000000009a1ec40:   00000000bff96fc8 0000000000000000
0x0000000009a1ec50:   00000000bfe9cec8 0000000000000000
0x0000000009a1ec60:   0000000008358000 0000000009a1edd8
0x0000000009a1ec70:   00000000c11b0880 0000000000000000
0x0000000009a1ec80:   00000000026a60f8 00000000bfe9dfd0
0x0000000009a1ec90:   0000000009a1edb0 00000000770d1a4a
0x0000000009a1eca0:   0000000009a1ed00 00000000c11b0880
0x0000000009a1ecb0:   0000000000000010 0000000000000000
0x0000000009a1ecc0:   0000000009a1ecc0 000007fef13aa810
0x0000000009a1ecd0:   0000000009a1ed50 00000000bff29dd0
0x0000000009a1ece0:   0000000000000000 00000000bff291b8
0x0000000009a1ecf0:   00000000c11b0880 000007fef13a7358
0x0000000009a1ed00:   0000000009a1eda8 00000000026a62d3
0x0000000009a1ed10:   0000000000000000 0000000000000000 

Instructions: (pc=0x0000000077323290)
0x0000000077323270:   ff ff 00 00 00 48 33 de 48 23 c1 48 c1 eb 04 48
0x0000000077323280:   33 d8 48 33 1d 3f f1 0d 00 48 c1 e3 04 0f 0d 0b
0x0000000077323290:   4c 8b 63 08 49 bd 01 00 00 00 01 00 00 00 49 be
0x00000000773232a0:   ff 7f 00 00 ff ff ff ff c6 42 0f 80 c6 42 0e 00 

Register to memory mapping:

RAX=0x0000003700001388 is an unknown value
RBX=0x0000000233be3ae0 is an unknown value
RCX=0x000000ffffffffff is an unknown value
RDX=0x00000000108fa970 is an unknown value
RSP=0x0000000009a1ec20 is pointing into the stack for thread: 0x0000000008358000
RBP=0x0000000000000000 is an unknown value
RSI=0x00000000108f0000 is an unknown value
RDI=0x00000000108fa980 is an unknown value
R8 =0x00000000108fa980 is an unknown value
R9 =0x00000000c5394fe0 is an oop
java.lang.Class 
 - klass: 'java/lang/Class'
R10=0x00000000026b3064 is at code_begin+644 in an Interpreter codelet
method entry point (kind = native)  [0x00000000026b2de0, 0x00000000026b3680]  2208 bytes
R11=0x000000006911f900 is an unknown value
R12=0x0000000000000000 is an unknown value
R13=0x00000000c11b0880 is an oop
{method} 
 - klass: {other class}
R14=0x0000000009a1edd8 is pointing into the stack for thread: 0x0000000008358000
R15=0x0000000008358000 is a thread

Stack: [0x0000000009920000,0x0000000009a20000],  sp=0x0000000009a1ec20,  free space=1019k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [ntdll.dll+0x53290]

[error occurred during error reporting (printing native stack), id 0xc0000005]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.bridj.JNI.free(J)V+0
j  org.bridj.Pointer$FreeReleaser.release(Lorg/bridj/Pointer;)V+192
j  org.bridj.Pointer$5.release(Lorg/bridj/Pointer;)V+14
j  org.bridj.Pointer$3.release()V+19
j  org.bridj.Pointer$3.finalize()V+1
v  ~StubRoutines::call_stub
j  java.lang.ref.Finalizer.invokeFinalizeMethod(Ljava/lang/Object;)V+0
j  java.lang.ref.Finalizer.runFinalizer()V+45
j  java.lang.ref.Finalizer.access$100(Ljava/lang/ref/Finalizer;)V+1
j  java.lang.ref.Finalizer$FinalizerThread.run()V+24
v  ~StubRoutines::call_stub

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

Java Threads: ( => current thread )
  0x000000000aa92000 JavaThread "webcam-lock-[ThinkVantage Virtual Camera 0]" daemon [_thread_blocked, id=10884, stack(0x0000000015420000,0x0000000015520000)]
  0x000000000aa90000 JavaThread "webcam-updater-thread-14" daemon [_thread_blocked, id=15116, stack(0x0000000015050000,0x0000000015150000)]
  0x000000000aa8f000 JavaThread "webcam-updater-thread-12" daemon [_thread_blocked, id=14816, stack(0x00000000155b0000,0x00000000156b0000)]
  0x000000000aa8d800 JavaThread "webcam-updater-thread-11" daemon [_thread_blocked, id=11768, stack(0x0000000015320000,0x0000000015420000)]
  0x000000000aa8e800 JavaThread "webcam-updater-thread-7" daemon [_thread_blocked, id=10808, stack(0x0000000014ec0000,0x0000000014fc0000)]
  0x000000000aa8d000 JavaThread "webcam-updater-thread-8" daemon [_thread_blocked, id=11484, stack(0x0000000014ba0000,0x0000000014ca0000)]
  0x000000000aa8c000 JavaThread "webcam-updater-thread-6" daemon [_thread_blocked, id=14020, stack(0x0000000014780000,0x0000000014880000)]
  0x000000000aa8b800 JavaThread "SwingWorker-pool-1-thread-10" daemon [_thread_blocked, id=15300, stack(0x0000000013f20000,0x0000000014020000)]
  0x000000000af1c000 JavaThread "SwingWorker-pool-1-thread-9" daemon [_thread_blocked, id=15264, stack(0x00000000144a0000,0x00000000145a0000)]
  0x000000000af17800 JavaThread "SwingWorker-pool-1-thread-8" daemon [_thread_blocked, id=6152, stack(0x000000000bc30000,0x000000000bd30000)]
  0x000000000af1a800 JavaThread "SwingWorker-pool-1-thread-7" daemon [_thread_blocked, id=15332, stack(0x0000000014160000,0x0000000014260000)]
  0x000000000af1a000 JavaThread "SwingWorker-pool-1-thread-6" daemon [_thread_blocked, id=15172, stack(0x0000000014020000,0x0000000014120000)]
  0x000000000af19000 JavaThread "SwingWorker-pool-1-thread-5" daemon [_thread_blocked, id=13656, stack(0x000000000b8a0000,0x000000000b9a0000)]
  0x000000000af16800 JavaThread "SwingWorker-pool-1-thread-4" daemon [_thread_blocked, id=3584, stack(0x000000000d3a0000,0x000000000d4a0000)]
  0x000000000af18000 JavaThread "atomic-processor-1" daemon [_thread_blocked, id=13848, stack(0x00000000105f0000,0x00000000106f0000)]
  0x000000000af16000 JavaThread "JNativeHook Native Dispatch" [_thread_blocked, id=11808, stack(0x00000000102d0000,0x00000000103d0000)]
  0x000000000af15000 JavaThread "JNativeHook Native Hook" [_thread_in_native, id=11084, stack(0x0000000010060000,0x0000000010160000)]
  0x000000000af14800 JavaThread "SwingWorker-pool-1-thread-3" daemon [_thread_blocked, id=14064, stack(0x000000000ff20000,0x0000000010020000)]
  0x000000000af13000 JavaThread "SwingWorker-pool-1-thread-2" daemon [_thread_blocked, id=4828, stack(0x000000000fa90000,0x000000000fb90000)]
  0x000000000af13800 JavaThread "Thread-4" [_thread_blocked, id=5056, stack(0x000000000fc50000,0x000000000fd50000)]
  0x000000000af12000 JavaThread "Timer-0" daemon [_thread_blocked, id=13988, stack(0x000000000f960000,0x000000000fa60000)]
  0x000000000af11800 JavaThread "gTeamScheduler_QuartzSchedulerThread" [_thread_blocked, id=14160, stack(0x000000000f7c0000,0x000000000f8c0000)]
  0x000000000af10800 JavaThread "gTeamScheduler_Worker-10" [_thread_blocked, id=5064, stack(0x000000000f540000,0x000000000f640000)]
  0x000000000af10000 JavaThread "gTeamScheduler_Worker-9" [_thread_blocked, id=10364, stack(0x000000000f370000,0x000000000f470000)]
  0x000000000af0f000 JavaThread "gTeamScheduler_Worker-8" [_thread_blocked, id=14208, stack(0x000000000ea70000,0x000000000eb70000)]
  0x000000000af0e800 JavaThread "gTeamScheduler_Worker-7" [_thread_blocked, id=14264, stack(0x000000000f260000,0x000000000f360000)]
  0x000000000af0d800 JavaThread "gTeamScheduler_Worker-6" [_thread_blocked, id=14268, stack(0x000000000f110000,0x000000000f210000)]
  0x000000000af0d000 JavaThread "gTeamScheduler_Worker-5" [_thread_blocked, id=5736, stack(0x000000000ef80000,0x000000000f080000)]
  0x000000000daa0800 JavaThread "gTeamScheduler_Worker-4" [_thread_blocked, id=13072, stack(0x000000000edb0000,0x000000000eeb0000)]
  0x000000000addc000 JavaThread "gTeamScheduler_Worker-3" [_thread_blocked, id=14212, stack(0x000000000d1f0000,0x000000000d2f0000)]
  0x000000000a1bc000 JavaThread "gTeamScheduler_Worker-2" [_thread_blocked, id=13412, stack(0x000000000ebd0000,0x000000000ecd0000)]
  0x000000000ab46000 JavaThread "gTeamScheduler_Worker-1" [_thread_blocked, id=13828, stack(0x000000000c2a0000,0x000000000c3a0000)]
  0x000000000aa0a000 JavaThread "SwingWorker-pool-1-thread-1" daemon [_thread_blocked, id=12252, stack(0x000000000d9a0000,0x000000000daa0000)]
  0x000000000aa09800 JavaThread "TimerQueue" daemon [_thread_blocked, id=7628, stack(0x000000000d850000,0x000000000d950000)]
  0x0000000002248000 JavaThread "DestroyJavaVM" [_thread_blocked, id=13704, stack(0x00000000025a0000,0x00000000026a0000)]
  0x000000000a2ac800 JavaThread "AWT-EventQueue-0" [_thread_in_Java, id=10316, stack(0x000000000c170000,0x000000000c270000)]
  0x000000000a2aa800 JavaThread "JUnique/Server/com.virtualoffice.client.Application" daemon [_thread_in_native, id=1772, stack(0x000000000bfb0000,0x000000000c0b0000)]
  0x000000000a21d800 JavaThread "AWT-Windows" daemon [_thread_in_native, id=11448, stack(0x000000000b5c0000,0x000000000b6c0000)]
  0x000000000a32c800 JavaThread "AWT-Shutdown" [_thread_blocked, id=12788, stack(0x000000000b4b0000,0x000000000b5b0000)]
  0x000000000a303800 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=12628, stack(0x000000000b2c0000,0x000000000b3c0000)]
  0x00000000083c3000 JavaThread "Service Thread" daemon [_thread_blocked, id=14200, stack(0x00000000095e0000,0x00000000096e0000)]
  0x00000000083b8800 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=13708, stack(0x0000000009f10000,0x000000000a010000)]
  0x00000000083b3800 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=8784, stack(0x0000000009da0000,0x0000000009ea0000)]
  0x00000000083b2800 JavaThread "Attach Listener" daemon [_thread_blocked, id=12784, stack(0x0000000009b80000,0x0000000009c80000)]
  0x00000000083ab800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=11552, stack(0x0000000009a30000,0x0000000009b30000)]
=>0x0000000008358000 JavaThread "Finalizer" daemon [_thread_in_native, id=13724, stack(0x0000000009920000,0x0000000009a20000)]
  0x0000000008351800 JavaThread "Reference Handler" daemon [_thread_blocked, id=12988, stack(0x0000000009730000,0x0000000009830000)]

Other Threads:
  0x000000000834b800 VMThread [stack: 0x00000000094b0000,0x00000000095b0000] [id=11760]
  0x000000000a020800 WatcherThread [stack: 0x000000000a5a0000,0x000000000a6a0000] [id=13264]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 PSYoungGen      total 78848K, used 3323K [0x00000000ec500000, 0x00000000f3f00000, 0x0000000100000000)
  eden space 78336K, 3% used [0x00000000ec500000,0x00000000ec80ed90,0x00000000f1180000)
  from space 512K, 37% used [0x00000000f3e00000,0x00000000f3e30020,0x00000000f3e80000)
  to   space 512K, 0% used [0x00000000f3e80000,0x00000000f3e80000,0x00000000f3f00000)
 ParOldGen       total 40960K, used 34480K [0x00000000c5000000, 0x00000000c7800000, 0x00000000ec500000)
  object space 40960K, 84% used [0x00000000c5000000,0x00000000c71ac318,0x00000000c7800000)
 PSPermGen       total 52224K, used 24136K [0x00000000bfe00000, 0x00000000c3100000, 0x00000000c5000000)
  object space 52224K, 46% used [0x00000000bfe00000,0x00000000c15920e0,0x00000000c3100000)

Card table byte_map: [0x00000000056a0000,0x00000000058b0000] byte_map_base: 0x00000000050a1000

Polling page: 0x0000000000130000

Code Cache  [0x00000000026a0000, 0x0000000002980000, 0x00000000056a0000)
 total_blobs=1362 nmethods=810 adapters=503 free_code_cache=46396Kb largest_free_block=47317120

Compilation events (10 events):
Event: 2297.481 Thread 0x00000000083b8800  885             java.util.regex.Pattern$Branch::match (66 bytes)
Event: 2297.484 Thread 0x00000000083b8800 nmethod 885 0x000000000294c150 code [0x000000000294c2a0, 0x000000000294c418]
Event: 2312.814 Thread 0x00000000083b3800  886   !         java.awt.Window::getOwnedWindows_NoClientCode (110 bytes)
Event: 2312.823 Thread 0x00000000083b3800 nmethod 886 0x00000000028f02d0 code [0x00000000028f0440, 0x00000000028f0fc8]
Event: 2314.070 Thread 0x00000000083b8800  887             sun.java2d.pipe.LoopPipe::drawLine (46 bytes)
Event: 2314.071 Thread 0x00000000083b8800 nmethod 887 0x000000000273dd90 code [0x000000000273dee0, 0x000000000273dfc8]
Event: 2325.246 Thread 0x00000000083b8800  888   !         sun.java2d.SunGraphics2D::drawLine (74 bytes)
Event: 2325.249 Thread 0x00000000083b8800 nmethod 888 0x00000000028551d0 code [0x0000000002855360, 0x00000000028555f0]
Event: 2326.592 Thread 0x00000000083b3800  889 % !         java.lang.ref.Reference$ReferenceHandler::run @ 0 (108 bytes)
Event: 2326.599 Thread 0x00000000083b3800 nmethod 889% 0x00000000028b0c10 code [0x00000000028b0da0, 0x00000000028b1ae8]

GC Heap History (10 events):
Event: 2326.591 GC heap before
{Heap before GC invocations=4738 (full 3):
 PSYoungGen      total 95232K, used 94896K [0x00000000ec500000, 0x00000000f3f00000, 0x0000000100000000)
  eden space 94720K, 100% used [0x00000000ec500000,0x00000000f2180000,0x00000000f2180000)
  from space 512K, 34% used [0x00000000f3e80000,0x00000000f3eac010,0x00000000f3f00000)
  to   space 512K, 0% used [0x00000000f3e00000,0x00000000f3e00000,0x00000000f3e80000)
 ParOldGen       total 40960K, used 31724K [0x00000000c5000000, 0x00000000c7800000, 0x00000000ec500000)
  object space 40960K, 77% used [0x00000000c5000000,0x00000000c6efb2e8,0x00000000c7800000)
 PSPermGen       total 52224K, used 24134K [0x00000000bfe00000, 0x00000000c3100000, 0x00000000c5000000)
  object space 52224K, 46% used [0x00000000bfe00000,0x00000000c1591a48,0x00000000c3100000)
Event: 2326.592 GC heap after
Heap after GC invocations=4738 (full 3):
 PSYoungGen      total 91648K, used 176K [0x00000000ec500000, 0x00000000f3f00000, 0x0000000100000000)
  eden space 91136K, 0% used [0x00000000ec500000,0x00000000ec500000,0x00000000f1e00000)
  from space 512K, 34% used [0x00000000f3e00000,0x00000000f3e2c010,0x00000000f3e80000)
  to   space 512K, 0% used [0x00000000f3e80000,0x00000000f3e80000,0x00000000f3f00000)
 ParOldGen       total 40960K, used 31740K [0x00000000c5000000, 0x00000000c7800000, 0x00000000ec500000)
  object space 40960K, 77% used [0x00000000c5000000,0x00000000c6eff2e8,0x00000000c7800000)
 PSPermGen       total 52224K, used 24134K [0x00000000bfe00000, 0x00000000c3100000, 0x00000000c5000000)
  object space 52224K, 46% used [0x00000000bfe00000,0x00000000c1591a48,0x00000000c3100000)
}
Event: 2326.961 GC heap before
{Heap before GC invocations=4739 (full 3):
 PSYoungGen      total 91648K, used 91312K [0x00000000ec500000, 0x00000000f3f00000, 0x0000000100000000)
  eden space 91136K, 100% used [0x00000000ec500000,0x00000000f1e00000,0x00000000f1e00000)
  from space 512K, 34% used [0x00000000f3e00000,0x00000000f3e2c010,0x00000000f3e80000)
  to   space 512K, 0% used [0x00000000f3e80000,0x00000000f3e80000,0x00000000f3f00000)
 ParOldGen       total 40960K, used 31740K [0x00000000c5000000, 0x00000000c7800000, 0x00000000ec500000)
  object space 40960K, 77% used [0x00000000c5000000,0x00000000c6eff2e8,0x00000000c7800000)
 PSPermGen       total 52224K, used 24136K [0x00000000bfe00000, 0x00000000c3100000, 0x00000000c5000000)
  object space 52224K, 46% used [0x00000000bfe00000,0x00000000c15920e0,0x00000000c3100000)
Event: 2326.963 GC heap after
Heap after GC invocations=4739 (full 3):
 PSYoungGen      total 88064K, used 224K [0x00000000ec500000, 0x00000000f3f00000, 0x0000000100000000)
  eden space 87552K, 0% used [0x00000000ec500000,0x00000000ec500000,0x00000000f1a80000)
  from space 512K, 43% used [0x00000000f3e80000,0x00000000f3eb8020,0x00000000f3f00000)
  to   space 512K, 0% used [0x00000000f3e00000,0x00000000f3e00000,0x00000000f3e80000)
 ParOldGen       total 40960K, used 34448K [0x00000000c5000000, 0x00000000c7800000, 0x00000000ec500000)
  object space 40960K, 84% used [0x00000000c5000000,0x00000000c71a4318,0x00000000c7800000)
 PSPermGen       total 52224K, used 24136K [0x00000000bfe00000, 0x00000000c3100000, 0x00000000c5000000)
  object space 52224K, 46% used [0x00000000bfe00000,0x00000000c15920e0,0x00000000c3100000)
}
Event: 2327.340 GC heap before
{Heap before GC invocations=4740 (full 3):
 PSYoungGen      total 88064K, used 87776K [0x00000000ec500000, 0x00000000f3f00000, 0x0000000100000000)
  eden space 87552K, 100% used [0x00000000ec500000,0x00000000f1a80000,0x00000000f1a80000)
  from space 512K, 43% used [0x00000000f3e80000,0x00000000f3eb8020,0x00000000f3f00000)
  to   space 512K, 0% used [0x00000000f3e00000,0x00000000f3e00000,0x00000000f3e80000)
 ParOldGen       total 40960K, used 34448K [0x00000000c5000000, 0x00000000c7800000, 0x00000000ec500000)
  object space 40960K, 84% used [0x00000000c5000000,0x00000000c71a4318,0x00000000c7800000)
 PSPermGen       total 52224K, used 24136K [0x00000000bfe00000, 0x00000000c3100000, 0x00000000c5000000)
  object space 52224K, 46% used [0x00000000bfe00000,0x00000000c15920e0,0x00000000c3100000)
Event: 2327.341 GC heap after
Heap after GC invocations=4740 (full 3):
 PSYoungGen      total 84992K, used 224K [0x00000000ec500000, 0x00000000f3f00000, 0x0000000100000000)
  eden space 84480K, 0% used [0x00000000ec500000,0x00000000ec500000,0x00000000f1780000)
  from space 512K, 43% used [0x00000000f3e00000,0x00000000f3e38020,0x00000000f3e80000)
  to   space 512K, 0% used [0x00000000f3e80000,0x00000000f3e80000,0x00000000f3f00000)
 ParOldGen       total 40960K, used 34464K [0x00000000c5000000, 0x00000000c7800000, 0x00000000ec500000)
  object space 40960K, 84% used [0x00000000c5000000,0x00000000c71a8318,0x00000000c7800000)
 PSPermGen       total 52224K, used 24136K [0x00000000bfe00000, 0x00000000c3100000, 0x00000000c5000000)
  object space 52224K, 46% used [0x00000000bfe00000,0x00000000c15920e0,0x00000000c3100000)
}
Event: 2327.701 GC heap before
{Heap before GC invocations=4741 (full 3):
 PSYoungGen      total 84992K, used 84704K [0x00000000ec500000, 0x00000000f3f00000, 0x0000000100000000)
  eden space 84480K, 100% used [0x00000000ec500000,0x00000000f1780000,0x00000000f1780000)
  from space 512K, 43% used [0x00000000f3e00000,0x00000000f3e38020,0x00000000f3e80000)
  to   space 512K, 0% used [0x00000000f3e80000,0x00000000f3e80000,0x00000000f3f00000)
 ParOldGen       total 40960K, used 34464K [0x00000000c5000000, 0x00000000c7800000, 0x00000000ec500000)
  object space 40960K, 84% used [0x00000000c5000000,0x00000000c71a8318,0x00000000c7800000)
 PSPermGen       total 52224K, used 24136K [0x00000000bfe00000, 0x00000000c3100000, 0x00000000c5000000)
  object space 52224K, 46% used [0x00000000bfe00000,0x00000000c15920e0,0x00000000c3100000)
Event: 2327.702 GC heap after
Heap after GC invocations=4741 (full 3):
 PSYoungGen      total 81920K, used 224K [0x00000000ec500000, 0x00000000f3f00000, 0x0000000100000000)
  eden space 81408K, 0% used [0x00000000ec500000,0x00000000ec500000,0x00000000f1480000)
  from space 512K, 43% used [0x00000000f3e80000,0x00000000f3eb8020,0x00000000f3f00000)
  to   space 512K, 0% used [0x00000000f3e00000,0x00000000f3e00000,0x00000000f3e80000)
 ParOldGen       total 40960K, used 34480K [0x00000000c5000000, 0x00000000c7800000, 0x00000000ec500000)
  object space 40960K, 84% used [0x00000000c5000000,0x00000000c71ac318,0x00000000c7800000)
 PSPermGen       total 52224K, used 24136K [0x00000000bfe00000, 0x00000000c3100000, 0x00000000c5000000)
  object space 52224K, 46% used [0x00000000bfe00000,0x00000000c15920e0,0x00000000c3100000)
}
Event: 2328.071 GC heap before
{Heap before GC invocations=4742 (full 3):
 PSYoungGen      total 81920K, used 81632K [0x00000000ec500000, 0x00000000f3f00000, 0x0000000100000000)
  eden space 81408K, 100% used [0x00000000ec500000,0x00000000f1480000,0x00000000f1480000)
  from space 512K, 43% used [0x00000000f3e80000,0x00000000f3eb8020,0x00000000f3f00000)
  to   space 512K, 0% used [0x00000000f3e00000,0x00000000f3e00000,0x00000000f3e80000)
 ParOldGen       total 40960K, used 34480K [0x00000000c5000000, 0x00000000c7800000, 0x00000000ec500000)
  object space 40960K, 84% used [0x00000000c5000000,0x00000000c71ac318,0x00000000c7800000)
 PSPermGen       total 52224K, used 24136K [0x00000000bfe00000, 0x00000000c3100000, 0x00000000c5000000)
  object space 52224K, 46% used [0x00000000bfe00000,0x00000000c15920e0,0x00000000c3100000)
Event: 2328.073 GC heap after
Heap after GC invocations=4742 (full 3):
 PSYoungGen      total 78848K, used 192K [0x00000000ec500000, 0x00000000f3f00000, 0x0000000100000000)
  eden space 78336K, 0% used [0x00000000ec500000,0x00000000ec500000,0x00000000f1180000)
  from space 512K, 37% used [0x00000000f3e00000,0x00000000f3e30020,0x00000000f3e80000)
  to   space 512K, 0% used [0x00000000f3e80000,0x00000000f3e80000,0x00000000f3f00000)
 ParOldGen       total 40960K, used 34480K [0x00000000c5000000, 0x00000000c7800000, 0x00000000ec500000)
  object space 40960K, 84% used [0x00000000c5000000,0x00000000c71ac318,0x00000000c7800000)
 PSPermGen       total 52224K, used 24136K [0x00000000bfe00000, 0x00000000c3100000, 0x00000000c5000000)
  object space 52224K, 46% used [0x00000000bfe00000,0x00000000c15920e0,0x00000000c3100000)
}

Deoptimization events (10 events):
Event: 2262.968 Thread 0x000000000a2ac800 Uncommon trap: reason=class_check action=maybe_recompile pc=0x0000000002902b98 method=java.awt.Window.processWindowEvent(Ljava/awt/event/WindowEvent;)V @ 108
Event: 2262.968 Thread 0x000000000a2ac800 Uncommon trap: reason=class_check action=maybe_recompile pc=0x00000000028f9128 method=java.awt.DefaultKeyboardFocusManager.dispatchEvent(Ljava/awt/AWTEvent;)Z @ 459
Event: 2263.574 Thread 0x000000000a2ac800 Uncommon trap: reason=class_check action=maybe_recompile pc=0x0000000002926168 method=java.awt.Window.dispose()V @ 1
Event: 2263.574 Thread 0x000000000a2ac800 Uncommon trap: reason=class_check action=maybe_recompile pc=0x00000000029222e0 method=java.awt.Window$1DisposeAction.run()V @ 131
Event: 2266.113 Thread 0x000000000a2ac800 Uncommon trap: reason=class_check action=maybe_recompile pc=0x00000000028f9128 method=java.awt.DefaultKeyboardFocusManager.dispatchEvent(Ljava/awt/AWTEvent;)Z @ 459
Event: 2266.765 Thread 0x000000000a2ac800 Uncommon trap: reason=class_check action=maybe_recompile pc=0x0000000002926168 method=java.awt.Window.dispose()V @ 1
Event: 2266.765 Thread 0x000000000a2ac800 Uncommon trap: reason=class_check action=maybe_recompile pc=0x00000000029222e0 method=java.awt.Window$1DisposeAction.run()V @ 131
Event: 2268.726 Thread 0x000000000a2ac800 Uncommon trap: reason=class_check action=maybe_recompile pc=0x000000000292b1d8 method=java.awt.Window$1DisposeAction.run()V @ 131
Event: 2269.572 Thread 0x000000000a2ac800 Uncommon trap: reason=class_check action=maybe_recompile pc=0x00000000028e9180 method=java.awt.Window$1DisposeAction.run()V @ 131
Event: 2270.154 Thread 0x000000000a2ac800 Uncommon trap: reason=null_check action=make_not_entrant pc=0x000000000288993c method=java.awt.Window.getOwnedWindows_NoClientCode()[Ljava/awt/Window; @ 52

Internal exceptions (10 events):
Event: 2255.810 Thread 0x000000000a2ac800 Implicit null exception at 0x000000000276bb60 to 0x000000000276bb95
Event: 2257.382 Thread 0x000000000a2ac800 Implicit null exception at 0x00000000028a99b1 to 0x00000000028a9c3d
Event: 2266.005 Thread 0x000000000aa8b800 Threw 0x00000000ec878890 at C:\re\jdk7u45\229\hotspot\src\share\vm\prims\jni.cpp:717
Event: 2270.154 Thread 0x000000000a2ac800 Implicit null exception at 0x00000000028891fb to 0x000000000288991d
Event: 2283.302 Thread 0x000000000af1b800 Threw 0x00000000ed7954e0 at C:\re\jdk7u45\229\hotspot\src\share\vm\prims\jvm.cpp:2965
Event: 2284.377 Thread 0x000000000af1b800 Threw 0x00000000ef71cb90 at C:\re\jdk7u45\229\hotspot\src\share\vm\prims\jvm.cpp:2965
Event: 2284.883 Thread 0x000000000af1b800 Threw 0x00000000eebaf4f8 at C:\re\jdk7u45\229\hotspot\src\share\vm\prims\jvm.cpp:2965
Event: 2285.304 Thread 0x000000000af1b800 Threw 0x00000000eccbda98 at C:\re\jdk7u45\229\hotspot\src\share\vm\prims\jvm.cpp:2965
Event: 2321.649 Thread 0x000000000aa90000 Threw 0x00000000edc93460 at C:\re\jdk7u45\229\hotspot\src\share\vm\prims\jvm.cpp:2965
Event: 2327.087 Thread 0x000000000aa90800 Threw 0x00000000ee17ff50 at C:\re\jdk7u45\229\hotspot\src\share\vm\prims\jvm.cpp:2965

Events (10 events):
Event: 2327.341 Executing VM operation: RevokeBias done
Event: 2327.341 Executing VM operation: BulkRevokeBias
Event: 2327.341 Executing VM operation: BulkRevokeBias done
Event: 2327.701 Executing VM operation: ParallelGCFailedAllocation
Event: 2327.702 Executing VM operation: ParallelGCFailedAllocation done
Event: 2327.909 Thread 0x000000000aa92000 Thread added: 0x000000000aa92000
Event: 2328.071 Executing VM operation: ParallelGCFailedAllocation
Event: 2328.073 Executing VM operation: ParallelGCFailedAllocation done
Event: 2328.073 Executing VM operation: RevokeBias
Event: 2328.073 Executing VM operation: RevokeBias done

Dynamic libraries:
0x000000013f7b0000 - 0x000000013f7e3000     C:\Windows\system32\java.exe
0x00000000772d0000 - 0x0000000077479000     C:\Windows\SYSTEM32\ntdll.dll
0x00000000770b0000 - 0x00000000771cf000     C:\Windows\system32\kernel32.dll
0x000007fefd2c0000 - 0x000007fefd32c000     C:\Windows\system32\KERNELBASE.dll
0x000007feff300000 - 0x000007feff3db000     C:\Windows\system32\ADVAPI32.dll
0x000007feff540000 - 0x000007feff5df000     C:\Windows\system32\msvcrt.dll
0x000007feff010000 - 0x000007feff02f000     C:\Windows\SYSTEM32\sechost.dll
0x000007feff030000 - 0x000007feff15d000     C:\Windows\system32\RPCRT4.dll
0x00000000771d0000 - 0x00000000772ca000     C:\Windows\system32\USER32.dll
0x000007fefd9e0000 - 0x000007fefda47000     C:\Windows\system32\GDI32.dll
0x000007fefda50000 - 0x000007fefda5e000     C:\Windows\system32\LPK.dll
0x000007feff230000 - 0x000007feff2f9000     C:\Windows\system32\USP10.dll
0x000007fefc170000 - 0x000007fefc364000     C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_fa396087175ac9ac\COMCTL32.dll
0x000007feff160000 - 0x000007feff1d1000     C:\Windows\system32\SHLWAPI.dll
0x000007fefd580000 - 0x000007fefd5ae000     C:\Windows\system32\IMM32.DLL
0x000007fefdc70000 - 0x000007fefdd79000     C:\Windows\system32\MSCTF.dll
0x0000000061e70000 - 0x0000000061f42000     C:\Program Files\Java\jre7\bin\msvcr100.dll
0x0000000068f40000 - 0x0000000069709000     C:\Program Files\Java\jre7\bin\server\jvm.dll
0x000007fef1230000 - 0x000007fef1239000     C:\Windows\system32\WSOCK32.dll
0x000007feff1e0000 - 0x000007feff22d000     C:\Windows\system32\WS2_32.dll
0x000007feff000000 - 0x000007feff008000     C:\Windows\system32\NSI.dll
0x000007fefadc0000 - 0x000007fefadfb000     C:\Windows\system32\WINMM.dll
0x00000000774a0000 - 0x00000000774a7000     C:\Windows\system32\PSAPI.DLL
0x0000000068300000 - 0x000000006830f000     C:\Program Files\Java\jre7\bin\verify.dll
0x0000000069fa0000 - 0x0000000069fc8000     C:\Program Files\Java\jre7\bin\java.dll
0x0000000074480000 - 0x0000000074495000     C:\Program Files\Java\jre7\bin\zip.dll
0x000000006a480000 - 0x000000006a499000     C:\Program Files\Java\jre7\bin\net.dll
0x000007fefc8e0000 - 0x000007fefc935000     C:\Windows\system32\mswsock.dll
0x000007fefc8d0000 - 0x000007fefc8d7000     C:\Windows\System32\wship6.dll
0x00000000699f0000 - 0x0000000069a01000     C:\Program Files\Java\jre7\bin\nio.dll
0x00000000635b0000 - 0x0000000063745000     C:\Program Files\Java\jre7\bin\awt.dll
0x000007fefd900000 - 0x000007fefd9d7000     C:\Windows\system32\OLEAUT32.dll
0x000007fefda60000 - 0x000007fefdc63000     C:\Windows\system32\ole32.dll
0x000007fefb320000 - 0x000007fefb376000     C:\Windows\system32\uxtheme.dll
0x000007fefb190000 - 0x000007fefb1a8000     C:\Windows\system32\dwmapi.dll
0x000007fefcfa0000 - 0x000007fefcfaf000     C:\Windows\system32\CRYPTBASE.dll
0x000007fefe270000 - 0x000007fefeff8000     C:\Windows\system32\SHELL32.dll
0x000007fefbbd0000 - 0x000007fefbbd7000     C:\Windows\System32\wshtcpip.dll
0x000007fefc760000 - 0x000007fefc7bb000     C:\Windows\system32\DNSAPI.dll
0x000007fef8830000 - 0x000007fef885f000     C:\Program Files\Common Files\Microsoft Shared\Windows Live\WLIDNSP.DLL
0x000007fefa0d0000 - 0x000007fefa0f7000     C:\Windows\system32\IPHLPAPI.DLL
0x000007fefa0b0000 - 0x000007fefa0bb000     C:\Windows\system32\WINNSI.DLL
0x000007fef8820000 - 0x000007fef8828000     C:\Windows\system32\rasadhlp.dll
0x000007fef9f40000 - 0x000007fef9f93000     C:\Windows\System32\fwpuclnt.dll
0x000000006a9f0000 - 0x000000006aa36000     C:\Program Files\Java\jre7\bin\fontmanager.dll
0x000007fefd4e0000 - 0x000007fefd579000     C:\Windows\system32\CLBCatQ.DLL
0x000007fefafb0000 - 0x000007fefb111000     C:\Windows\system32\WindowsCodecs.dll
0x000007fefcf40000 - 0x000007fefcf97000     C:\Windows\system32\apphelp.dll
0x000000006c2b0000 - 0x000000006c2c6000     C:\Program Files\Common Files\TortoiseOverlays\TortoiseOverlays.dll
0x000000006c290000 - 0x000000006c2a7000     C:\Program Files\TortoiseSVN\bin\TortoiseStub.dll
0x000000006c210000 - 0x000000006c28c000     C:\Program Files\TortoiseSVN\bin\TortoiseSVN.dll
0x000007fefd5b0000 - 0x000007fefd7e0000     C:\Windows\system32\WININET.dll
0x000007fefd270000 - 0x000007fefd274000     C:\Windows\system32\api-ms-win-downlevel-user32-l1-1-0.dll
0x000007fefd200000 - 0x000007fefd204000     C:\Windows\system32\api-ms-win-downlevel-shlwapi-l1-1-0.dll
0x000007fefd260000 - 0x000007fefd264000     C:\Windows\system32\api-ms-win-downlevel-version-l1-1-0.dll
0x000007fefbed0000 - 0x000007fefbedc000     C:\Windows\system32\version.DLL
0x000007fefd250000 - 0x000007fefd253000     C:\Windows\system32\api-ms-win-downlevel-normaliz-l1-1-0.dll
0x0000000077490000 - 0x0000000077493000     C:\Windows\system32\normaliz.DLL
0x000007fefdd80000 - 0x000007fefe02a000     C:\Windows\system32\iertutil.dll
0x000007fefd330000 - 0x000007fefd335000     C:\Windows\system32\api-ms-win-downlevel-advapi32-l1-1-0.dll
0x000007fefd210000 - 0x000007fefd22e000     C:\Windows\system32\USERENV.dll
0x000007fefd110000 - 0x000007fefd11f000     C:\Windows\system32\profapi.dll
0x000007fef5d10000 - 0x000007fef6178000     C:\Program Files\TortoiseSVN\bin\libsvn_tsvn.dll
0x000000006c1e0000 - 0x000000006c20d000     C:\Program Files\TortoiseSVN\bin\libapr_tsvn.dll
0x000007fef5c30000 - 0x000007fef5d04000     C:\Windows\system32\MSVCR110.dll
0x000000006c190000 - 0x000000006c1d5000     C:\Program Files\TortoiseSVN\bin\libaprutil_tsvn.dll
0x000007fefe030000 - 0x000007fefe082000     C:\Windows\system32\WLDAP32.dll
0x000007fef5c10000 - 0x000007fef5c21000     C:\Program Files\TortoiseSVN\bin\intl3_tsvn.dll
0x000007fef5bf0000 - 0x000007fef5c09000     C:\Program Files\TortoiseSVN\bin\libsasl.dll
0x000007fefcd50000 - 0x000007fefcd5b000     C:\Windows\system32\Secur32.dll
0x000007fefcf10000 - 0x000007fefcf35000     C:\Windows\system32\SSPICLI.DLL
0x000007fefd340000 - 0x000007fefd4ac000     C:\Windows\system32\CRYPT32.dll
0x000007fefd100000 - 0x000007fefd10f000     C:\Windows\system32\MSASN1.dll
0x000007fef5b40000 - 0x000007fef5be7000     C:\Windows\system32\MSVCP110.dll
0x000007fef4f50000 - 0x000007fef516c000     C:\Program Files\TortoiseCVS\TortoiseShell64.dll
0x000007fefbf50000 - 0x000007fefc166000     C:\Windows\WinSxS\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.18455_none_2b283fd671e9bf4d\gdiplus.dll
0x000000006c0b0000 - 0x000000006c183000     C:\Windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_08e61857a83bc251\MSVCP90.dll
0x0000000074c30000 - 0x0000000074cd3000     C:\Windows\WinSxS\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_08e61857a83bc251\MSVCR90.dll
0x000007fefa5c0000 - 0x000007fefa631000     C:\Windows\system32\WINSPOOL.DRV
0x000007fefd860000 - 0x000007fefd8f7000     C:\Windows\system32\COMDLG32.dll
0x000007fef5b00000 - 0x000007fef5b35000     C:\Windows\system32\EhStorShell.dll
0x000007fefe090000 - 0x000007fefe267000     C:\Windows\system32\SETUPAPI.dll
0x000007fefd280000 - 0x000007fefd2b6000     C:\Windows\system32\CFGMGR32.dll
0x000007fefd230000 - 0x000007fefd24a000     C:\Windows\system32\DEVOBJ.dll
0x000007fefb3d0000 - 0x000007fefb4fc000     C:\Windows\system32\PROPSYS.dll
0x000007fef4ed0000 - 0x000007fef4f4a000     C:\Program Files (x86)\Kaspersky Lab\Kaspersky PURE 3.0\x64\shellex.dll
0x000000006c010000 - 0x000000006c0a8000     C:\Program Files (x86)\Kaspersky Lab\Kaspersky PURE 3.0\x64\MSVCP100.dll
0x000007fef4e50000 - 0x000007fef4ece000     C:\Windows\System32\cscui.dll
0x000007fef4e40000 - 0x000007fef4e4c000     C:\Windows\System32\CSCDLL.dll
0x000007fef7e80000 - 0x000007fef7e8f000     C:\Windows\system32\CSCAPI.dll
0x000007fef4dc0000 - 0x000007fef4e40000     C:\Windows\system32\ntshrui.dll
0x000007fefcbc0000 - 0x000007fefcbe3000     C:\Windows\system32\srvcli.dll
0x000007fefac70000 - 0x000007fefac7b000     C:\Windows\system32\slc.dll
0x0000000180000000 - 0x0000000180076000     C:\Program Files (x86)\SugarSync\SugarSyncShellExt_x64.dll
0x0000000074ce0000 - 0x0000000074da9000     C:\Windows\WinSxS\amd64_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.6195_none_88e41e092fab0294\MSVCR80.dll
0x0000000074620000 - 0x0000000074661000     C:\Program Files\Java\jre7\bin\t2k.dll
0x000000006a760000 - 0x000000006a784000     C:\Program Files\Java\jre7\bin\sunec.dll
0x000000006b5f0000 - 0x000000006b5fb000     C:\Program Files\Java\jre7\bin\sunmscapi.dll
0x000007fefcb30000 - 0x000007fefcb47000     C:\Windows\system32\CRYPTSP.dll
0x000007fefc640000 - 0x000007fefc687000     C:\Windows\system32\rsaenh.dll
0x000007fefb170000 - 0x000007fefb185000     C:\Windows\system32\NLAapi.dll
0x000007fef31b0000 - 0x000007fef31c5000     C:\Windows\system32\napinsp.dll
0x000007fef3190000 - 0x000007fef31a9000     C:\Windows\system32\pnrpnsp.dll
0x000007fef3650000 - 0x000007fef365b000     C:\Windows\System32\winrnr.dll
0x000007fef3180000 - 0x000007fef3190000     C:\Windows\system32\wshbth.dll
0x000007fee52b0000 - 0x000007fee534c000     C:\Windows\system32\mscms.dll
0x000007fee51a0000 - 0x000007fee51e2000     C:\Windows\system32\icm32.dll
0x000000006ff40000 - 0x000000006ff50000     C:\Users\Kaustubha\AppData\Local\Temp\JNativeHook_6328650755335398264.dll
0x000007fef6de0000 - 0x000007fef6de4000     C:\Windows\system32\KBDINEN.DLL
0x000007fef13a0000 - 0x000007fef13c9000     C:\Users\Kaustubha\AppData\Local\Temp\BridJExtractedLibraries2619707711402646931\bridj.dll
0x000007fee4b60000 - 0x000007fee4b96000     C:\Users\KAUSTU~1\AppData\Local\Temp\BridJExtractedLibraries2619707711402646931\OpenIMAJGrabber.dll
0x000007feeff90000 - 0x000007feeffa6000     C:\Windows\system32\devenum.dll
0x000007fefaf80000 - 0x000007fefafad000     C:\Windows\system32\ntmarta.dll
0x000007fefd1c0000 - 0x000007fefd1fa000     C:\Windows\system32\WINTRUST.dll
0x000007fef77d0000 - 0x000007fef77dd000     C:\Windows\system32\msdmo.dll
0x000007fee3670000 - 0x000007fee36a7000     C:\Users\Kaustubha\AppData\Local\Temp\jna-Kaustubha\jna4565891018985778933.dll
0x000007fee4b30000 - 0x000007fee4b5f000     C:\Windows\system32\qcap.dll
0x000007fee1fe0000 - 0x000007fee2192000     C:\Windows\system32\quartz.dll
0x000007fee1f90000 - 0x000007fee1fd1000     C:\Windows\system32\ksproxy.ax
0x0000000074c20000 - 0x0000000074c26000     C:\Windows\system32\ksuser.dll
0x000007fee25a0000 - 0x000007fee279f000     C:\Windows\system32\d3d9.dll
0x000007fefa900000 - 0x000007fefa907000     C:\Windows\system32\d3d8thk.dll
0x000007fef6bc0000 - 0x000007fef6bcb000     C:\Windows\system32\vidcap.ax
0x000007fee3310000 - 0x000007fee3334000     C:\Windows\system32\kswdmcap.ax
0x000007fee1e30000 - 0x000007fee1f8c000     C:\Windows\system32\MFC42.dll
0x000007fee1d70000 - 0x000007fee1e21000     C:\Windows\system32\ODBC32.dll
0x0000000060990000 - 0x00000000609c8000     C:\Windows\system32\odbcint.dll
0x000007fee1cd0000 - 0x000007fee1d6b000     C:\Windows\System32\qedit.dll

VM Arguments:
jvm_args: -XX:-HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=C:/Program Files (x86)/gTeam/jre 
java_command: com.virtualoffice.client.Application
Launcher Type: SUN_STANDARD

Environment Variables:
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_45
PATH=C:\Program Files (x86)\ImageMagick-6.5.6-Q8;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\ThinkPad\Bluetooth Software\;C:\Program Files\ThinkPad\Bluetooth Software\syswow64;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Common Files\Lenovo;C:\Program Files (x86)\Common Files\Ulead Systems\MPEG;C:\Program Files (x86)\Windows Live\Shared;C:\SWTOOLS\ReadyApps;C:\Program Files (x86)\Common Files\Lenovo;C:\Program Files\TortoiseSVN\bin;C:\Program Files\OpenVPN\bin;C:\Program Files (x86)\Java\jre7\bin\;C:\Program Files\Amazon\AWSCLI\;C:\Program Files\Java\jdk1.7.0_45\bin;C:\Devfactory\ant\bin;C:\Ruby187\bin;C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin\;C:\Program Files (x86)\CVSNT\;C:\Program Files (x86)\Bitvise SSH Client
USERNAME=Kaustubha
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 58 Stepping 9, GenuineIntel

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

OS: Windows 7 , 64 bit Build 7601 Service Pack 1

CPU:total 4 (2 cores per cpu, 2 threads per core) family 6 model 58 stepping 9, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, aes, erms, ht, tsc, tscinvbit, tscinv

Memory: 4k page, physical 3865904k(1065360k free), swap 7729944k(3407840k free)

vm_info: Java HotSpot(TM) 64-Bit Server VM (24.45-b08) for windows-amd64 JRE (1.7.0_45-b18), built on Oct  8 2013 05:47:22 by "java_re" with unknown MS VC++:1600

time: Sat Jun 21 00:19:40 2014
elapsed time: 2328 seconds
kaustubhasgudi commented 10 years ago

Issue is reproducible in at least 4 machines. I think looking at the problem frame it's related to bridj.jar but may be I am missing something.

sarxos commented 10 years ago

@kaustubhasgudi,

We can see that the crash is caused by the illegal access exception on BridJ JNI.free() invoked indirectly by the finalizer preparing references to be garbage collected.

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.bridj.JNI.free(J)V+0
j  org.bridj.Pointer$FreeReleaser.release(Lorg/bridj/Pointer;)V+192
j  org.bridj.Pointer$5.release(Lorg/bridj/Pointer;)V+14
j  org.bridj.Pointer$3.release()V+19
j  org.bridj.Pointer$3.finalize()V+1
v  ~StubRoutines::call_stub
j  java.lang.ref.Finalizer.invokeFinalizeMethod(Ljava/lang/Object;)V+0
j  java.lang.ref.Finalizer.runFinalizer()V+45
j  java.lang.ref.Finalizer.access$100(Ljava/lang/ref/Finalizer;)V+1
j  java.lang.ref.Finalizer$FinalizerThread.run()V+24
v  ~StubRoutines::call_stub

Before we move with this issue, I would like you to check if this specific issue is reproducible with newest and older BridJ versions.

Can you please try again with the following JARs?

There is another thing which bothers me, but it's probably not connected with the crash. I see there are several webcam updaters alive on the threads list:

  0x000000000aa90000 JavaThread "webcam-updater-thread-14" daemon [_thread_blocked, id=15116, stack(0x0000000015050000,0x0000000015150000)]
  0x000000000aa8f000 JavaThread "webcam-updater-thread-12" daemon [_thread_blocked, id=14816, stack(0x00000000155b0000,0x00000000156b0000)]
  0x000000000aa8d800 JavaThread "webcam-updater-thread-11" daemon [_thread_blocked, id=11768, stack(0x0000000015320000,0x0000000015420000)]
  0x000000000aa8e800 JavaThread "webcam-updater-thread-7" daemon [_thread_blocked, id=10808, stack(0x0000000014ec0000,0x0000000014fc0000)]
  0x000000000aa8d000 JavaThread "webcam-updater-thread-8" daemon [_thread_blocked, id=11484, stack(0x0000000014ba0000,0x0000000014ca0000)]
  0x000000000aa8c000 JavaThread "webcam-updater-thread-6" daemon [_thread_blocked, id=14020, stack(0x0000000014780000,0x0000000014880000)]

This must be some bug because it should be only one per webcam instance. From the log I see you are using only one webcam (ThinkVantage Virtual Camera 0) and you have 6 updaters. I will need to investigate this. Will keep you informed.

Please let me know if the problem exists with other BridJ versions.

kaustubhasgudi commented 10 years ago

Hi @sarxos

I'll check the jars as you mentioned. And for the multiple webcam-updater threads I have a doubt as to whether they are due to the design of the application I am working upon. The application I am working upon schedules a webcam capture to be taken every 10 minutes using cron scheduler. So could be possible that all other threads didn't finalise due to an exception which ultimately caused the application to crash. May be I am missing something but I will investigate that .

sarxos commented 10 years ago

@kaustubhasgudi,

There was a bug in the code. There was two distinct mechanisms in one class - one designed to update image reference working only when webcam is in async mode, and second one to perform listeners notifications whenever new image is available. Both used same thread factory and so notificators were visible ad updater threads, which was wrong. The other issue is the fact that the executor controlling notificators was never shutdown, so in some situations these threads could possibly spawn again and again... This is now fixed. Ah, and it was not connected with the JVM crash.

sarxos commented 10 years ago

And here is the newest JAR:

https://oss.sonatype.org/content/repositories/snapshots/com/github/sarxos/webcam-capture/0.3.10-SNAPSHOT/webcam-capture-0.3.10-20140622.001501-33.jar

kaustubhasgudi commented 10 years ago

@sarxos

HotSpot Error obtained on using the new jar

Current thread (0x00000000082c5000):  JavaThread "Finalizer" daemon [_thread_in_native, id=12264, stack(0x0000000009730000,0x0000000009830000)]

Stack: [0x0000000009730000,0x0000000009830000],  sp=0x000000000982e980,  free space=1018k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [ntdll.dll+0x53290]

[error occurred during error reporting (printing native stack), id 0xc0000005]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.bridj.JNI.free(J)V+0
j  org.bridj.Pointer$FreeReleaser.release(Lorg/bridj/Pointer;)V+667
j  org.bridj.Pointer$5.release(Lorg/bridj/Pointer;)V+27
j  org.bridj.Pointer$3.release()V+32
j  org.bridj.Pointer$3.finalize()V+14
v  ~StubRoutines::call_stub
j  java.lang.ref.Finalizer.invokeFinalizeMethod(Ljava/lang/Object;)V+0
j  java.lang.ref.Finalizer.runFinalizer()V+45
j  java.lang.ref.Finalizer.access$100(Ljava/lang/ref/Finalizer;)V+1
j  java.lang.ref.Finalizer$FinalizerThread.run()V+24
v  ~StubRoutines::call_stub
sarxos commented 10 years ago

The last fix wasn't to address JVM crash issue. Have you verified it with the other BridJ versions?

kaustubhasgudi commented 10 years ago

Yes. Just finished testing with other BridJ versions and tested in all 4 systems. None of them seem to keep the app stable. With newer version of BridJ the crash is definite after starting the app and continuing with it for 3 hrs. . With the official jars the crash is not frequent and needs some unpleasant activity in the system relevant to the crash. I'm working on to fix some stability issues with my app threads as some of them are spawned unnecessarily but I probably would say they didn't cause the crash as such. Still not sure what caused the crash. Just investigating :)

sarxos commented 10 years ago

@kaustubhasgudi,

Can you please prepare the log with DEBUG prints from the app? Here is the instruction of how to enable full debug for Webcam Capture, OpenIMAJ and BridJ:

https://github.com/sarxos/webcam-capture/wiki/How-To-Enable-Dubug-Logs

This is important to understand what is happening under the hood.

I think that some references are being deleted before finalizer process them, which later causes JVM to crash because the memory reserved by instance to be released is already deallocated. The BridJ seems to work as expected. The JNI.free(J) is a native, which calls:

void JNICALL Java_org_bridj_JNI_free(JNIEnv *env, jclass clazz, jlong ptr) {
  BEGIN_TRY_CALL(env);
  free(JLONG_TO_PTR(ptr));
  END_TRY_CALL(env);
}

And free(long) indirectly calls object destructor on OpenIMAJ instances:

OpenIMAJGrabber::~OpenIMAJGrabber(){
  if(((videoData*)this->data)->buffer!=NULL)
    delete[] ((videoData*)this->data)->buffer;
  delete ((videoData*)this->data)->VI;
  delete ((videoData*)this->data);
}

Which IMHO causes JVM crash, but we need strong prove for this.

I understand that your application is active for many hours, when it open the webcam once per 10 minutes, take the picture and then close? Is this the case? Does it crash while running or when you close it?

kaustubhasgudi commented 10 years ago

Yes. It's a multithreaded application (11 threads for different purposes) using cron scheduler and webcam takes pictures randomly once every 10 mins. And yes it crashes while running all of a sudden right after webcam.close() is called , although when I investigated more thoroughly I saw webcam did capture the image , image was saved and webcam thread (SwingWorker) as it needs to become free it crashes with the above error. I'll start the app with debug logs enabled and get back.

sarxos commented 10 years ago

Ok, and is the webcam invoked from all the threads, or only from one?

sarxos commented 10 years ago

@kaustubhasgudi, is the issue reproducible when you create very basic example doing nothing but opening the webcam once per 10 minutes, taking the image and then closing it?

Here is the code. Can you please run it for several hours to verify if it creates the problem?

import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

import com.github.sarxos.webcam.Webcam;

public class NeverEndingLoopExample {

    public static void main(String[] args) throws IOException, InterruptedException {

        Webcam.getDiscoveryService().setEnabled(false);

        Webcam webcam = Webcam.getDefault();
        File file = new File("test.jpg");

        do {

            webcam.open();
            ImageIO.write(webcam.getImage(), "JPG", file);
            webcam.close();

            Thread.sleep(1000 * 60 * 10); // sleep 10 minutes

        } while (true);
    }
}

Also, can you try adding this line in your code, just before you start using Webcam class. E.g. at the very beginning of your main(..) method.

Webcam.getDiscoveryService().setEnabled(false);
kaustubhasgudi commented 10 years ago

Hi @sarxos

I noticed one strange thing in one of the machines here. After installing gStreamer WinLibs + updating the webcam driver there isn't any crash anymore.

In another machine where I work most of the times, there seems to be a jre issue. It was using jre 1.6 x32 and I had to install x64 as the operating system was x64 bit. I'll try with the sample you just posted above. I just don't want to deal with multiple issues here arising due to multiple environments and want to focus on just the crash so that I can delineate between compatibility issues and fixes required for webcam-capture jar. The webcam is invoked only once and it's a singleton called using a SwingWorker.

But in another machine if I run using jre 1.7 through command prompt there is a JVM crash but if I run using jre 1.6 no crash. I am not sure if higher version is not supported in this case. Just investigating.

Sorry for the late reply. I've been very sick since few days and unable to give time to work.

sarxos commented 10 years ago

Hi @kaustubhasgudi,

I hope you are feeling much better now :)

The native drivers causes problems very often. Some of them are not very good quality, may not support the standards, and thus, some hax in the code may be required be added, but unfortunately there is no room for such thing in Java since the API exposed from natives is very thin :(

I never tried using 32-bit Java on 64-bit system, but this may, in theory, cause problem as well, since, depending on what arch is detected, different DLL is loaded in runtime (different for win 32- and 64-bit).

The higher version of JRE should not make any problems. I was testing on 6, 7 and 8 with every of these releases working just fine.

sarxos commented 10 years ago

@kaustubhasgudi, I just verified that there is no issue when using newest Webcam Capture API + gstremaer-driver on 64-bit Windows 7 and 32-bit Java 8.