Why is my Java Application Silently having a fatal error?
<p>I've never seen this, maybe it is a bug in the jvm? </p>

<p>I added some code to solve sudokus:</p>

<pre><code>private boolean solve( int row, int col, Cell[][] cells )
{
    if ( row == NUM_PUZZLE_ROWS )
    {
        row = 0;
        col++;
        if ( col == NUM_PUZZLE_COLUMNS )
            return true;
    }
    if ( cells[row][col].getValue() != 0 )  // skip filled cells
        return solve( row + 1, col, cells );

    for (int val = 1; val &lt;= NUM_PUZZLE_ROWS; val++)
    {
        if ( isPossible( row, col, val, cells ) )
        {
            cells[row][col].setValue( val );
            if ( solve( row + 1, col, cells ) )
                return true;
        }
    }

    cells[row][col].setValue( 0 ); // reset on backtrack
    return false;

}

private boolean isPossible(
        int row, int col, int val, Cell[][] cells )
{

    //check the row
    for (int r = 0; r &lt; 9; r++)  // row
    {
        //no duplicates permitted
        if ( val == cells[r][col].getValue() )
            return false;
    }


    //check the column
    for (int c = 0; c &lt; 9; c++) // col
    {
        //no duplicates permitted
        if ( val == cells[row][c].getValue() )
            return false;
    }

    int rowOffset = (row / 3) * 3;
    int colOffset = (col / 3) * 3;

    //check the 3x3 box
    for (int r = 0; r &lt; 3; ++r)
    {
        for (int c = 0; c &lt; 3; ++c)
        {
            if ( val == cells[rowOffset + r][colOffset + c].getValue() )
            {
                return false;
            }
        }
    }

    return true; // no violations, so it's possible
}

private boolean solve( Cell[][] cells )
{
    resetPuzzle();
    return solve( 0, 0, cells );
}

public boolean solve()
{
    return solve( cells );
}
</code></pre>

<p>I trigger this code with the solve button. The code works great. The puzzle is solved and everything works fine. Until I close the application. This does not happen everytime but: It only ever happens when I have solved a puzzle and of those times only happens half the time.</p>

<p>The application closes fine but it returns 1 rather than 0 success and leaves this log file:</p>

<blockquote>
  <p>A fatal error has been detected by the Java Runtime Environment:</p>
  
  <p>EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d93591e, pid=2368, tid=2040</p>
  
  <p>JRE version: 6.0_27-b07
   Java VM: Java HotSpot(TM) Client VM (20.2-b06 mixed mode, sharing windows-x86 )
   Problematic frame:
   V  [jvm.dll+0x9591e]</p>
  
  <p>If you would like to submit a bug report, please visit:
     <a href="http://java.sun.com/webapps/bugreport/crash.jsp" rel="nofollow">http://java.sun.com/webapps/bugreport/crash.jsp</a></p>
  
  <p>---------------  T H R E A D  ---------------</p>
  
  <p>Current thread (0x02be1800):  JavaThread "AWT-Windows" daemon
  [_thread_in_vm, id=2040, stack(0x02fa0000,0x02ff0000)]</p>
  
  <p>siginfo: ExceptionCode=0xc0000005, reading address 0x00000000</p>
  
  <p>Registers: EAX=0x02be20c8, EBX=0x00000000, ECX=0x00000000,
  EDX=0x02fef89c ESP=0x02fef88c, EBP=0x02fef920, ESI=0x02be1800,
  EDI=0x02bde6d0 EIP=0x6d93591e, EFLAGS=0x00010202</p>
  
  <p>Top of Stack: (sp=0x02fef88c) 0x02fef88c:   02b002b8 02be1928 02be1800
  000c3550 0x02fef89c:   02be20c8 000c3528 00000000 02fef97c 0x02fef8ac:
  7c91084c 000b01a0 7c910981 000b0608 0x02fef8bc:   7c91015d 000c3550
  000c3530 02fef89c 0x02fef8cc:   02fef8bd 00000001 00000008 00000000
  0x02fef8dc:   7e428d8b 6d14cea1 02fef8f4 00000000 0x02fef8ec:<br>
  02fef91c 6d8a2af6 02be1800 02be2df8 0x02fef8fc:   02be1800 02be1928
  02fef8f8 02be1c88 </p>
  
  <p>Instructions: (pc=0x6d93591e) 0x6d9358fe:   78 ff ff ff 89 41 14 8b 45
  ac c6 04 10 01 8b 4d 0x6d93590e:   b0 8b 55 a8 8b 45 f4 89 04 8a ff 45
  b0 8b 5d fc 0x6d93591e:   8b 03 8b 48 08 0f b7 51 2a 8b 40 0c 8b 4c 90
  28 0x6d93592e:   51 56 8d 4d bc e8 d8 a5 07 00 8b 55 18 33 c0 89 </p>
  
  <p>Register to memory mapping:</p>
  
  <p>EAX=0x02be20c8 is an unknown value EBX=0x00000000 is an unknown value
  ECX=0x00000000 is an unknown value EDX=0x02fef89c is pointing into the
  stack for thread: 0x02be1800 ESP=0x02fef88c is pointing into the stack
  for thread: 0x02be1800 EBP=0x02fef920 is pointing into the stack for
  thread: 0x02be1800 ESI=0x02be1800 is a thread EDI=0x02bde6d0 is an
  unknown value</p>
  
  <p>Stack: [0x02fa0000,0x02ff0000],  sp=0x02fef88c,  free space=318k
  Native frames: (J=compiled Java code, j=interpreted, Vv=VM code,
  C=native code) V  [jvm.dll+0x9591e] V  [jvm.dll+0x9884c] C 
  [awt.dll+0x6cbbc]  Java_sun_awt_windows_WChoicePeer_create+0x10c C 
  [USER32.dll+0x8734]  GetDC+0x6d C  [USER32.dll+0x8816]  GetDC+0x14f C 
  [USER32.dll+0x18ea0]  DefWindowProcW+0x180 C  [USER32.dll+0x18eec] 
  DefWindowProcW+0x1cc C  [ntdll.dll+0xe473] 
  KiUserCallbackDispatcher+0x13</p>
  
  <p>Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j 
  sun.awt.windows.WToolkit.eventLoop()V+0 j 
  sun.awt.windows.WToolkit.run()V+52 j  java.lang.Thread.run()V+11 v 
  ~StubRoutines::call_stub</p>
  
  <p>---------------  P R O C E S S  ---------------</p>
  
  <p>Java Threads: ( => current thread )   0x02ba1400 JavaThread "Thread-1"
  daemon [_thread_in_native, id=924, stack(0x03230000,0x03280000)]<br>
  0x002b6c00 JavaThread "DestroyJavaVM" [_thread_blocked, id=3688,
  stack(0x008c0000,0x00910000)]   0x03136c00 JavaThread
  "AWT-EventQueue-0" [_thread_blocked, id=376,
  stack(0x03280000,0x032d0000)]
  =>0x02be1800 JavaThread "AWT-Windows" daemon [_thread_in_vm, id=2040, stack(0x02fa0000,0x02ff0000)]   0x02be0800 JavaThread "AWT-Shutdown"
  [_thread_blocked, id=1924, stack(0x02f50000,0x02fa0000)]   0x02bdec00
  JavaThread "Java2D Disposer" daemon [_thread_in_native, id=3992,
  stack(0x02f00000,0x02f50000)]   0x02b57c00 JavaThread "Low Memory
  Detector" daemon [_thread_blocked, id=3804,
  stack(0x02dd0000,0x02e20000)]   0x02b52000 JavaThread "C1
  CompilerThread0" daemon [_thread_blocked, id=612,
  stack(0x02d80000,0x02dd0000)]   0x02b50400 JavaThread "Attach
  Listener" daemon [_thread_blocked, id=3916,
  stack(0x02d30000,0x02d80000)]   0x02b4f000 JavaThread "Signal
  Dispatcher" daemon [_thread_blocked, id=3844,
  stack(0x02ce0000,0x02d30000)]   0x02b48400 JavaThread "Finalizer"
  daemon [_thread_blocked, id=4092, stack(0x02c90000,0x02ce0000)]<br>
  0x02b46c00 JavaThread "Reference Handler" daemon [_thread_blocked,
  id=2828, stack(0x02c40000,0x02c90000)]</p>
  
  <p>Other Threads:   0x02b0ac00 VMThread [stack: 0x02bf0000,0x02c40000]
  [id=3612]   0x02b63000 WatcherThread [stack: 0x02e20000,0x02e70000]
  [id=1944]</p>
  
  <p>VM state:not at safepoint (normal execution)</p>
  
  <p>VM Mutex/Monitor currently owned by a thread: None</p>
  
  <p>Heap  def new generation   total 4928K, used 823K [0x22990000,
  0x22ee0000, 0x27ee0000)   eden space 4416K,   7% used [0x22990000,
  0x229ddc50, 0x22de0000)   from space 512K, 100% used [0x22e60000,
  0x22ee0000, 0x22ee0000)   to   space 512K,   0% used [0x22de0000,
  0x22de0000, 0x22e60000)  tenured generation   total 10944K, used 1261K
  [0x27ee0000, 0x28990000, 0x32990000)    the space 10944K,  11% used
  [0x27ee0000, 0x2801b590, 0x2801b600, 0x28990000)  compacting perm gen 
  total 12288K, used 244K [0x32990000, 0x33590000, 0x36990000)    the
  space 12288K,   1% used [0x32990000, 0x329cd110, 0x329cd200,
  0x33590000)
      ro space 10240K,  54% used [0x36990000, 0x36f0f548, 0x36f0f600, 0x37390000)
      rw space 12288K,  55% used [0x37390000, 0x37a35140, 0x37a35200, 0x37f90000)</p>
  
  <p>Code Cache  [0x00910000, 0x009e0000, 0x02910000)  total_blobs=410
  nmethods=214 adapters=132 free_code_cache=32713344
  largest_free_block=0</p>
  
  <p>Dynamic libraries: 0x00400000 - 0x00424000    C:\Program
  Files\Java\jdk1.6.0_27\bin\java.exe 0x7c900000 - 0x7c9b2000
    C:\WINDOWS\system32\ntdll.dll 0x7c800000 - 0x7c8f6000
    C:\WINDOWS\system32\kernel32.dll 0x77dd0000 - 0x77e6b000
    C:\WINDOWS\system32\ADVAPI32.dll 0x77e70000 - 0x77f03000
    C:\WINDOWS\system32\RPCRT4.dll 0x77fe0000 - 0x77ff1000
    C:\WINDOWS\system32\Secur32.dll 0x7c340000 - 0x7c396000     C:\Program
  Files\Java\jdk1.6.0_27\jre\bin\msvcr71.dll 0x6d8a0000 - 0x6db4f000
    C:\Program Files\Java\jdk1.6.0_27\jre\bin\client\jvm.dll 0x7e410000 -
  0x7e4a1000    C:\WINDOWS\system32\USER32.dll 0x77f10000 - 0x77f59000
    C:\WINDOWS\system32\GDI32.dll 0x76b40000 - 0x76b6d000
    C:\WINDOWS\system32\WINMM.dll 0x76390000 - 0x763ad000
    C:\WINDOWS\system32\IMM32.DLL 0x6d850000 - 0x6d85c000   C:\Program
  Files\Java\jdk1.6.0_27\jre\bin\verify.dll 0x6d3d0000 - 0x6d3ef000
    C:\Program Files\Java\jdk1.6.0_27\jre\bin\java.dll 0x6d890000 -
  0x6d89f000    C:\Program Files\Java\jdk1.6.0_27\jre\bin\zip.dll
  0x6d0b0000 - 0x6d1fc000   C:\Program
  Files\Java\jdk1.6.0_27\jre\bin\awt.dll 0x73000000 - 0x73026000
    C:\WINDOWS\system32\WINSPOOL.DRV 0x77c10000 - 0x77c68000
    C:\WINDOWS\system32\msvcrt.dll 0x774e0000 - 0x7761e000
    C:\WINDOWS\system32\ole32.dll 0x773d0000 - 0x774d3000
    C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.6028_x-ww_61e65202\COMCTL32.dll
  0x77f60000 - 0x77fd6000   C:\WINDOWS\system32\SHLWAPI.dll 0x5ad70000 -
  0x5ada8000    C:\WINDOWS\system32\uxtheme.dll 0x6d2e0000 - 0x6d32f000
    C:\Program Files\Java\jdk1.6.0_27\jre\bin\fontmanager.dll 0x74720000
  - 0x7476c000  C:\WINDOWS\system32\MSCTF.dll 0x755c0000 - 0x755ee000   C:\WINDOWS\system32\msctfime.ime 0x7c9c0000 - 0x7d1d7000
    C:\WINDOWS\system32\shell32.dll 0x6d6b0000 - 0x6d6c3000     C:\Program
  Files\Java\jdk1.6.0_27\jre\bin\net.dll 0x71ab0000 - 0x71ac7000
    C:\WINDOWS\system32\WS2_32.dll 0x71aa0000 - 0x71aa8000
    C:\WINDOWS\system32\WS2HELP.dll 0x6d6d0000 - 0x6d6d9000     C:\Program
  Files\Java\jdk1.6.0_27\jre\bin\nio.dll 0x76bf0000 - 0x76bfb000
    C:\WINDOWS\system32\PSAPI.DLL</p>
  
  <p>VM Arguments: jvm_args: -Dfile.encoding=UTF-8
  -Djava.security.policy=applet.policy  java_command: SudokuApp Launcher Type: SUN_STANDARD</p>
  
  <p>Environment Variables: CLASSPATH=.;C:\Program
  Files\Java\jre6\lib\ext\QTJava.zip
  PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\windows\system32\WindowsPowerShell\v1.0;C:\windows\system32\WindowsPowerShell\v1.0;C:\Program
  Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common
  Files\Roxio Shared\OEM\DLLShared\;C:\Program Files\Common Files\Roxio
  Shared\OEM\DLLShared\;C:\Program Files\Common Files\Roxio
  Shared\OEM\12.0\DLLShared\;C:\Program
  Files\Roxio\OEM\AudioCore\;C:\Program Files\Microsoft SQL
  Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL
  Server\100\DTS\Binn\;C:\Program Files\QuickTime\QTSystem\
  USERNAME=0935231 OS=Windows_NT PROCESSOR_IDENTIFIER=x86 Family 6 Model
  42 Stepping 7, GenuineIntel</p>
  
  <p>---------------  S Y S T E M  ---------------</p>
  
  <p>OS: Windows XP Build 2600 Service Pack 3</p>
  
  <p>CPU:total 8 (4 cores per cpu, 2 threads per core) family 6 model 42
  stepping 7, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1,
  sse4.2, popcnt, ht</p>
  
  <p>Memory: 4k page, physical 3318716k(2487016k free), swap
  7866808k(7197684k free)</p>
  
  <p>vm_info: Java HotSpot(TM) Client VM (20.2-b06) for windows-x86 JRE
  (1.6.0_27-b07), built on Jul 19 2011 01:04:42 by "java_re" with MS
  VC++ 7.1 (VS2003)</p>
  
  <p>time: Mon Nov 28 12:30:52 2011 elapsed time: 10 seconds</p>
</blockquote>

<p>What could be wrong?
The code does not throw any exceptions and there are no signs of anything going wrong.</p>

<p>Thanks</p>
