diff --git a/manifest b/manifest index 3f39575619..36b6563a1b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\sin\sloadext.test\scausing\san\serror\son\sOSX.\sThis\sis\snot\sa\sreal\sproblem,\sjust\sa\scase\sof\sthe\stest\sscript\sexpecting\sa\sslightly\sdifferent\serror\smessage\sthan\sthe\sone\sreturned.\s(CVS\s6361) -D 2009-03-20T09:09:37 +C Fix\sa\sproblem\sin\sthread005.test\scause\serrors\son\sosx.\s(CVS\s6362) +D 2009-03-20T10:24:04 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 583e87706abc3026960ed759aff6371faf84c211 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -561,7 +561,7 @@ F test/thread001.test 06c45ed9597d478e7bbdc2a8937e1ebea2a20a32 F test/thread002.test 4338c3d7c5f2f781adc3dba956dfd92722397408 F test/thread003.test a8bc91af1d9d524148dd84e4d6a196ba17521e08 F test/thread004.test 9d8ea6a9b0d62d35ad0b967e010d723ed99f614a -F test/thread005.test eefba87ff7aab212db4e8e19a0b01cdb73e3e536 +F test/thread005.test ffe656387fd77bfc674eff08c268efc2f789c4bd F test/thread1.test 862dd006d189e8b0946935db17399dcac2f8ef91 F test/thread2.test 91f105374f18a66e73a3254c28fe7c77af69bdea F test/thread_common.tcl bde5a0faa9fc57e24140483d512718d72bfc42e2 @@ -709,7 +709,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P cc0d925669ddeb55048e88aa5b4f658be60b0962 -R c2b4f8dc2ed503f7f98d2a8993a8e276 +P 18680989b5365b0e35fadca5919dfced22433ff4 +R 84c3a02fa54e49a7eceb26ef6ca40a97 U danielk1977 -Z 17fd67756579ad71d085631289576f09 +Z 7df2e0e297e433d337cbcfc3fa681e86 diff --git a/manifest.uuid b/manifest.uuid index 0fc8e1dd4c..c25516de85 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -18680989b5365b0e35fadca5919dfced22433ff4 \ No newline at end of file +56e6fca1a9da69c3a0fe43b00db9a6d9d93f03ba \ No newline at end of file diff --git a/test/thread005.test b/test/thread005.test index 9d97421b93..f40e182a24 100644 --- a/test/thread005.test +++ b/test/thread005.test @@ -11,7 +11,7 @@ # # Test a race-condition that shows up in shared-cache mode. # -# $Id: thread005.test,v 1.2 2009/03/16 17:07:57 drh Exp $ +# $Id: thread005.test,v 1.3 2009/03/20 10:24:04 danielk1977 Exp $ set testdir [file dirname $argv0] @@ -93,6 +93,7 @@ do_test thread005-1.1 { db close } {} + set ThreadProgram { proc execsql {zSql {db {}}} { if {$db eq ""} {set db $::DB} @@ -143,6 +144,7 @@ set ThreadProgram { if {[string match "SQLITE_LOCKED*" $msg]} { catch { execsql ROLLBACK } } else { + sqlite3_close $::DB error $msg } } elseif {$msg ne "0"} { @@ -154,12 +156,32 @@ set ThreadProgram { set result } +# There is a race-condition in btree.c that means that if two threads +# attempt to open the same database at roughly the same time, and there +# does not already exist a shared-cache corresponding to that database, +# then two shared-caches can be created instead of one. Things still more +# or less work, but the two database connections do not use the same +# shared-cache. +# +# If the threads run by this test hit this race-condition, the tests +# fail (because SQLITE_BUSY may be unexpectedly returned instead of +# SQLITE_LOCKED). To prevent this from happening, open a couple of +# connections to test.db and test2.db now to make sure that there are +# already shared-caches in memory for all databases opened by the +# test threads. +# +sqlite3 db test.db +sqlite3 db test2.db + puts "Running thread-tests for ~20 seconds" thread_spawn finished(0) {set isWriter 0} $ThreadProgram thread_spawn finished(1) {set isWriter 1} $ThreadProgram if {![info exists finished(0)]} { vwait finished(0) } if {![info exists finished(1)]} { vwait finished(1) } +catch { db close } +catch { db2 close } + do_test thread005-1.2 { list $finished(0) $finished(1) } {ok ok}