我从来没有见过这样的东西。我已经花了一个多小时将其缩减到最简单的我能得到它。
import java.io.File;
import java.sql.*;
public class Test {
private static final String DB_PATH = "test.db";
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Class.forName("org.sqlite.JDBC");
new File(DB_PATH).delete();
Connection conn = null;
Statement s = null;
try {
conn = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH);
s = conn.createStatement();
s.execute("CREATE TABLE person (id integer primary key, name text)");
s.execute("CREATE VIEW person_view AS SELECT p.id, p.name FROM person p");
s.execute(""
+ "CREATE TRIGGER person_view_delete INSTEAD OF DELETE ON person_view "
+ "BEGIN delete from person where id = old.id; END"
);
s.executeUpdate("INSERT INTO person (id, name) VALUES (42, 'hi')");
System.out.println("After this line...");
s.executeUpdate("DELETE FROM person_view WHERE id = 42");
System.out.println("And before this line...");
} finally {
try {
if (s != null) s.close();
} finally {
if (conn != null) conn.close();
}
}
}
}
每次都会崩溃。日志文件:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x76f09b69, pid=3148, tid=5752
#
# JRE version: 7.0_15-b03
# Java VM: Java HotSpot(TM) Client VM (23.7-b01 mixed mode, sharing windows-x86 )
# Problematic frame:
# C [msvcrt.dll+0x9b69] memcpy+0x259
#
# 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 (0x0076a800): JavaThread "main" [_thread_in_native, id=5752, stack(0x00d70000,0x00dc0000)]
siginfo: ExceptionCode=0xc0000005, reading address 0x00000000
Registers:
EAX=0x00000002, EBX=0x00000054, ECX=0x00000000, EDX=0x00000002
ESP=0x00dbefb0, EBP=0x00dbefb8, ESI=0x00000000, EDI=0x00dbf2a0
EIP=0x76f09b69, EFLAGS=0x00010293
Top of Stack: (sp=0x00dbefb0)
0x00dbefb0: 00dbf280 00000002 00dbefe8 6c2c6d44
0x00dbefc0: 00dbf2a0 00000000 00000002 6c2e5daa
0x00dbefd0: 00000094 0523dcd0 00dbf108 00000054
0x00dbefe0: 00000000 0523cd00 00dbf258 6c2c6b44
0x00dbeff0: 00dbf280 00000000 00000002 6c2c6d44
0x00dbf000: 00dbf2f7 6c317342 00000001 00000000
0x00dbf010: 00000005 00000000 00000005 00000000
0x00dbf020: 00000007 6c317342 00dbf298 6c2c5bae
Instructions: (pc=0x76f09b69)
0x76f09b49: 03 88 47 03 8a 46 02 88 47 02 8a 46 01 88 47 01
0x76f09b59: 8b 45 08 5e 5f c9 c3 f3 a5 ff 24 95 b8 99 f0 76
0x76f09b69: 8a 06 88 07 8a 46 01 88 47 01 8b 45 08 5e 5f c9
0x76f09b79: c3 83 3d 44 00 fa 76 00 0f 84 b5 fd ff ff 57 56
Register to memory mapping:
EAX=0x00000002 is an unknown value
EBX=0x00000054 is an unknown value
ECX=0x00000000 is an unknown value
EDX=0x00000002 is an unknown value
ESP=0x00dbefb0 is pointing into the stack for thread: 0x0076a800
EBP=0x00dbefb8 is pointing into the stack for thread: 0x0076a800
ESI=0x00000000 is an unknown value
EDI=0x00dbf2a0 is pointing into the stack for thread: 0x0076a800
Stack: [0x00d70000,0x00dc0000], sp=0x00dbefb0, free space=315k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [msvcrt.dll+0x9b69] memcpy+0x259
C [libsqlitejdbc-6544525787688936286.lib+0x6d44] Java_org_sqlite_NativeDB_column_1metadata+0x46ac
C [libsqlitejdbc-6544525787688936286.lib+0x6b44] Java_org_sqlite_NativeDB_column_1metadata+0x44ac
C [libsqlitejdbc-6544525787688936286.lib+0x6e5d] Java_org_sqlite_NativeDB_column_1metadata+0x47c5
C [libsqlitejdbc-6544525787688936286.lib+0x6ea5] Java_org_sqlite_NativeDB_column_1metadata+0x480d
C [libsqlitejdbc-6544525787688936286.lib+0x37a21] Java_org_sqlite_NativeDB_column_1metadata+0x35389
C [libsqlitejdbc-6544525787688936286.lib+0x39b3e] Java_org_sqlite_NativeDB_column_1metadata+0x374a6
C [libsqlitejdbc-6544525787688936286.lib+0x228ab] Java_org_sqlite_NativeDB_column_1metadata+0x20213
C [libsqlitejdbc-6544525787688936286.lib+0x3a05f] Java_org_sqlite_NativeDB_column_1metadata+0x379c7
C [libsqlitejdbc-6544525787688936286.lib+0x3a138] Java_org_sqlite_NativeDB_column_1metadata+0x37aa0
C [libsqlitejdbc-6544525787688936286.lib+0x3a506] Java_org_sqlite_NativeDB_column_1metadata+0x37e6e
C [libsqlitejdbc-6544525787688936286.lib+0x2e694] Java_org_sqlite_NativeDB_column_1metadata+0x2bffc
C [libsqlitejdbc-6544525787688936286.lib+0x2e924] Java_org_sqlite_NativeDB_column_1metadata+0x2c28c
C [libsqlitejdbc-6544525787688936286.lib+0x4331b] Java_org_sqlite_NativeDB_column_1metadata+0x40c83
C [libsqlitejdbc-6544525787688936286.lib+0x446c3] Java_org_sqlite_NativeDB_column_1metadata+0x4202b
C [libsqlitejdbc-6544525787688936286.lib+0x45200] Java_org_sqlite_NativeDB_column_1metadata+0x42b68
C [libsqlitejdbc-6544525787688936286.lib+0x35e54] Java_org_sqlite_NativeDB_column_1metadata+0x337bc
C [libsqlitejdbc-6544525787688936286.lib+0x3613d] Java_org_sqlite_NativeDB_column_1metadata+0x33aa5
C [libsqlitejdbc-6544525787688936286.lib+0x36219] Java_org_sqlite_NativeDB_column_1metadata+0x33b81
C [libsqlitejdbc-6544525787688936286.lib+0x1b1e] Java_org_sqlite_NativeDB_prepare+0x3c
j org.sqlite.NativeDB.prepare(Ljava/lang/String;)J+0
j org.sqlite.DB.prepare(Lorg/sqlite/Stmt;)V+21
j org.sqlite.Stmt.executeUpdate(Ljava/lang/String;)I+16
j Test.main([Ljava/lang/String;)V+83
v ~StubRoutines::call_stub
V [jvm.dll+0x12a34a]
V [jvm.dll+0x1d968e]
V [jvm.dll+0x12a3cd]
V [jvm.dll+0xaede4]
V [jvm.dll+0xb9157]
C [javaw.exe+0x206c]
C [javaw.exe+0xa5a1]
C [javaw.exe+0xa62b]
C [kernel32.dll+0x133aa] BaseThreadInitThunk+0x12
C [ntdll.dll+0x39ef2] RtlInitializeExceptionChain+0x63
C [ntdll.dll+0x39ec5] RtlInitializeExceptionChain+0x36
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j org.sqlite.NativeDB.prepare(Ljava/lang/String;)J+0
j org.sqlite.DB.prepare(Lorg/sqlite/Stmt;)V+21
j org.sqlite.Stmt.executeUpdate(Ljava/lang/String;)I+16
j Test.main([Ljava/lang/String;)V+83
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x00e8e800 JavaThread "Service Thread" daemon [_thread_blocked, id=5104, stack(0x04a30000,0x04a80000)]
0x00e80c00 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=5128, stack(0x04450000,0x044a0000)]
0x00e7f800 JavaThread "Attach Listener" daemon [_thread_blocked, id=6088, stack(0x04930000,0x04980000)]
0x00e7c800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=4676, stack(0x047b0000,0x04800000)]
0x00e69c00 JavaThread "Finalizer" daemon [_thread_blocked, id=5528, stack(0x04580000,0x045d0000)]
0x00e65000 JavaThread "Reference Handler" daemon [_thread_blocked, id=1184, stack(0x044d0000,0x04520000)]
=>0x0076a800 JavaThread "main" [_thread_in_native, id=5752, stack(0x00d70000,0x00dc0000)]
Other Threads:
0x00e63400 VMThread [stack: 0x045d0000,0x04620000] [id=1656]
0x00ea9800 WatcherThread [stack: 0x048a0000,0x048f0000] [id=5976]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 4928K, used 1106K [0x23f00000, 0x24450000, 0x29450000)
eden space 4416K, 25% used [0x23f00000, 0x24014aa8, 0x24350000)
from space 512K, 0% used [0x24350000, 0x24350000, 0x243d0000)
to space 512K, 0% used [0x243d0000, 0x243d0000, 0x24450000)
tenured generation total 10944K, used 0K [0x29450000, 0x29f00000, 0x33f00000)
the space 10944K, 0% used [0x29450000, 0x29450000, 0x29450200, 0x29f00000)
compacting perm gen total 12288K, used 580K [0x33f00000, 0x34b00000, 0x37f00000)
the space 12288K, 4% used [0x33f00000, 0x33f91090, 0x33f91200, 0x34b00000)
ro space 10240K, 45% used [0x37f00000, 0x38387290, 0x38387400, 0x38900000)
rw space 12288K, 54% used [0x38900000, 0x38f8ace8, 0x38f8ae00, 0x39500000)
Card table byte_map: [0x00ec0000,0x00f70000] byte_map_base: 0x00da0800
Polling page: 0x004d0000
Code Cache [0x02450000, 0x024f8000, 0x04450000)
total_blobs=186 nmethods=38 adapters=84 free_code_cache=32107Kb largest_free_block=32877568
Compilation events (10 events):
Event: 0.288 Thread 0x00e80c00 33 sun.security.provider.SHA::implCompress (491 bytes)
Event: 0.290 Thread 0x00e80c00 nmethod 33 0x024f19c8 code [0x024f1b20, 0x024f20ac]
Event: 0.290 Thread 0x00e80c00 34 sun.nio.cs.SingleByte$Encoder::encode (114 bytes)
Event: 0.291 Thread 0x00e80c00 nmethod 34 0x024f2888 code [0x024f29a0, 0x024f2c70]
Event: 0.369 Thread 0x00e80c00 35 java.lang.String::<init> (67 bytes)
Event: 0.369 Thread 0x00e80c00 nmethod 35 0x024f42c8 code [0x024f4400, 0x024f4640]
Event: 0.370 Thread 0x00e80c00 36 java.util.Arrays::copyOfRange (63 bytes)
Event: 0.371 Thread 0x00e80c00 nmethod 36 0x024f4808 code [0x024f4960, 0x024f4cf8]
Event: 0.372 Thread 0x00e80c00 38 java.lang.Integer::reverseBytes (26 bytes)
Event: 0.372 Thread 0x00e80c00 nmethod 38 0x024f5248 code [0x024f5340, 0x024f53d0]
GC Heap History (0 events):
No events
Deoptimization events (0 events):
No events
Internal exceptions (10 events):
Event: 0.177 Thread 0x0076a800 Threw 0x23f6f700 at C:\jdk7u2_32P\jdk7u15\hotspot\src\share\vm\prims\jvm.cpp:1166
Event: 0.181 Thread 0x0076a800 Threw 0x23f714d8 at C:\jdk7u2_32P\jdk7u15\hotspot\src\share\vm\prims\jvm.cpp:1166
Event: 0.214 Thread 0x0076a800 Threw 0x23f7a8c8 at C:\jdk7u2_32P\jdk7u15\hotspot\src\share\vm\prims\jvm.cpp:1166
Event: 0.216 Thread 0x0076a800 Threw 0x23f7f950 at C:\jdk7u2_32P\jdk7u15\hotspot\src\share\vm\prims\jvm.cpp:1166
Event: 0.217 Thread 0x0076a800 Threw 0x23f85a80 at C:\jdk7u2_32P\jdk7u15\hotspot\src\share\vm\prims\jvm.cpp:1166
Event: 0.221 Thread 0x0076a800 Threw 0x23f897e8 at C:\jdk7u2_32P\jdk7u15\hotspot\src\share\vm\prims\jvm.cpp:1166
Event: 0.409 Thread 0x0076a800 Threw 0x23ff5c10 at C:\jdk7u2_32P\jdk7u15\hotspot\src\share\vm\prims\jvm.cpp:1166
Event: 0.413 Thread 0x0076a800 Threw 0x23ff8c18 at C:\jdk7u2_32P\jdk7u15\hotspot\src\share\vm\prims\jvm.cpp:1166
Event: 0.414 Thread 0x0076a800 Threw 0x23ffe960 at C:\jdk7u2_32P\jdk7u15\hotspot\src\share\vm\prims\jvm.cpp:1166
Event: 0.420 Thread 0x0076a800 Threw 0x24007ac8 at C:\jdk7u2_32P\jdk7u15\hotspot\src\share\vm\prims\jvm.cpp:1166
Events (10 events):
Event: 0.412 loading class 0x04b5af90
Event: 0.413 loading class 0x04b5af90 done
Event: 0.414 loading class 0x04bd0740
Event: 0.414 loading class 0x04bd0740 done
Event: 0.418 loading class 0x04bd0a38
Event: 0.419 loading class 0x04bd0a38 done
Event: 0.420 loading class 0x04bd06c8
Event: 0.420 loading class 0x04bd06c8 done
Event: 0.421 loading class 0x04bc42b8
Event: 0.422 loading class 0x04bc42b8 done
Dynamic libraries:
0x01020000 - 0x0104f000 C:\Program Files (x86)\Java\jdk1.7.0_15\bin\javaw.exe
0x77920000 - 0x77aa0000 C:\Windows\SysWOW64\ntdll.dll
0x75060000 - 0x75170000 C:\Windows\syswow64\kernel32.dll
0x76990000 - 0x769d7000 C:\Windows\syswow64\KERNELBASE.dll
0x751e0000 - 0x75280000 C:\Windows\syswow64\ADVAPI32.dll
0x76f00000 - 0x76fac000 C:\Windows\syswow64\msvcrt.dll
0x76ee0000 - 0x76ef9000 C:\Windows\SysWOW64\sechost.dll
0x76c10000 - 0x76d00000 C:\Windows\syswow64\RPCRT4.dll
0x75000000 - 0x75060000 C:\Windows\syswow64\SspiCli.dll
0x74ff0000 - 0x74ffc000 C:\Windows\syswow64\CRYPTBASE.dll
0x755a0000 - 0x756a0000 C:\Windows\syswow64\USER32.dll
0x767a0000 - 0x76830000 C:\Windows\syswow64\GDI32.dll
0x76550000 - 0x7655a000 C:\Windows\syswow64\LPK.dll
0x75500000 - 0x7559d000 C:\Windows\syswow64\USP10.dll
0x726c0000 - 0x7285e000 C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2\COMCTL32.dll
0x76fb0000 - 0x77007000 C:\Windows\syswow64\SHLWAPI.dll
0x75170000 - 0x751d0000 C:\Windows\system32\IMM32.DLL
0x75430000 - 0x754fc000 C:\Windows\syswow64\MSCTF.dll
0x676d0000 - 0x6778e000 C:\Program Files (x86)\Java\jdk1.7.0_15\jre\bin\msvcr100.dll
0x66af0000 - 0x66e3c000 C:\Program Files (x86)\Java\jdk1.7.0_15\jre\bin\client\jvm.dll
0x6f3e0000 - 0x6f3e7000 C:\Windows\system32\WSOCK32.dll
0x76ba0000 - 0x76bd5000 C:\Windows\syswow64\WS2_32.dll
0x76d20000 - 0x76d26000 C:\Windows\syswow64\NSI.dll
0x729b0000 - 0x729e2000 C:\Windows\system32\WINMM.dll
0x751d0000 - 0x751d5000 C:\Windows\syswow64\PSAPI.DLL
0x67e20000 - 0x67e2c000 C:\Program Files (x86)\Java\jdk1.7.0_15\jre\bin\verify.dll
0x677e0000 - 0x67800000 C:\Program Files (x86)\Java\jdk1.7.0_15\jre\bin\java.dll
0x6a040000 - 0x6a053000 C:\Program Files (x86)\Java\jdk1.7.0_15\jre\bin\zip.dll
0x6ea20000 - 0x6ea36000 C:\Windows\system32\CRYPTSP.dll
0x6e990000 - 0x6e9cb000 C:\Windows\system32\rsaenh.dll
0x72a00000 - 0x72a17000 C:\Windows\system32\USERENV.dll
0x729f0000 - 0x729fb000 C:\Windows\system32\profapi.dll
0x6a060000 - 0x6a074000 C:\Program Files (x86)\Java\jdk1.7.0_15\jre\bin\net.dll
0x6e9e0000 - 0x6ea1c000 C:\Windows\system32\mswsock.dll
0x73ea0000 - 0x73ea6000 C:\Windows\System32\wship6.dll
0x71f80000 - 0x71f90000 C:\Windows\system32\NLAapi.dll
0x72600000 - 0x72610000 C:\Windows\system32\napinsp.dll
0x725e0000 - 0x725f2000 C:\Windows\system32\pnrpnsp.dll
0x6d7d0000 - 0x6d814000 C:\Windows\system32\DNSAPI.dll
0x725d0000 - 0x725d8000 C:\Windows\System32\winrnr.dll
0x72060000 - 0x72065000 C:\Windows\System32\wshtcpip.dll
0x728c0000 - 0x728dc000 C:\Windows\system32\IPHLPAPI.DLL
0x728b0000 - 0x728b7000 C:\Windows\system32\WINNSI.DLL
0x741a0000 - 0x741a6000 C:\Windows\system32\rasadhlp.dll
0x6be50000 - 0x6be88000 C:\Windows\System32\fwpuclnt.dll
0x6a030000 - 0x6a03e000 C:\Program Files (x86)\Java\jdk1.7.0_15\jre\bin\nio.dll
0x6c2c0000 - 0x6c322000 C:\Users\Paul\AppData\Local\Temp\libsqlitejdbc-6544525787688936286.lib
0x72250000 - 0x7233b000 C:\Windows\system32\dbghelp.dll
VM Arguments:
jvm_args: -Dfile.encoding=Cp1252
java_command: Test
Launcher Type: SUN_STANDARD
Environment Variables:
JAVA_HOME=C:\Program Files (x86)\Java\jdk1.7.0_15
PATH=C:/Program Files (x86)/Java/jre7/bin/client;C:/Program Files (x86)/Java/jre7/bin;C:/Program Files (x86)/Java/jre7/lib/i386;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\PharosSystems\Core;C:\Program Files (x86)\Java\jdk1.7.0_15\bin;C:\eclipse;
USERNAME=Paul
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 15 Stepping 13, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows 7 , 64 bit Build 7601 Service Pack 1
CPU:total 2 (2 cores per cpu, 1 threads per core) family 6 model 15 stepping 13, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, tsc
Memory: 4k page, physical 3143744k(933004k free), swap 6285632k(3672076k free)
vm_info: Java HotSpot(TM) Client VM (23.7-b01) for windows-x86 JRE (1.7.0_15-b03), built on Feb 15 2013 14:01:25 by "java_re" with unknown MS VC++:1600
time: Thu Apr 04 05:46:55 2013
elapsed time: 0 seconds
我正在使用sqlitejdbc-v056,我正在Eclipse中开发。
我已将其导出为jar并运行它;我已经在命令行(Eclipse外部)将其编译为.class。在这两种情况下,我都无法重现这一点。
奇怪的是,如果我将视图定义为CREATE VIEW person_view AS SELECT id, name FROM person
,我不会收到任何错误。
我个人向所有能够理解为什么会这样的人表示祝贺。 (我也有兴趣知道是否还有其他人可以复制它。)
答案 0 :(得分:2)
我有两种想法,天气使这个答案或评论。这不是OP的答案,但对未来的读者可能非常有用。建议未来的读者检查他们是否有最新版本,因为这解决了OP的问题。
如果不是答案,为什么要发帖?... 我只是提出了一个非常类似的错误,根据错误本身无法区分错误。我尝试了许多不同版本的xerial sqlite-library并且尝试了同样的事情。
经过很长一段时间在Google上,除了空白之外,我最终发现这个错误是由我的代码触发的。我曾经有效地致电:
conn = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH);
s = conn.createStatement();
s.execute(null); // oops
发生这种情况是因为我的所有查询都打包并在运行时单独加载,不正确的引用会导致应该有查询的空指针。
一般情况下,您希望代码不会导致JVM崩溃。但是,在基于JNI的库的情况下,情况并非总是如此。似乎xerial sqlite-jdbc库不执行完整的空检查,并且某些事情(例如空SQL查询)将导致它在空指针上使JVM崩溃。
空指针由错误文件中的地址“0x00000000”显示:
siginfo: ExceptionCode=0xc0000005, reading address 0x00000000
然而,由于这也出现在OP的问题中,似乎先前版本中的错误无论如何都会导致这种情况。