From 333f80562b6bd9bb976f9d276e9586bc82b673cc Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 20 Apr 2016 18:31:27 +0000 Subject: [PATCH] Fix a locking race condition in Windows 10 that can occur when two or more processes attempt to recover the same hot journal at the same time. FossilOrigin-Name: 38a4e9d92887898b779493c71e4500f777a4e2e7 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/os_win.c | 5 ++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index eb27e8449c..0271d96ed6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\squotes\sfrom\sidentifiers\sused\sas\sdatatype\snames\sin\sa\sCREATE\sTABLE\nstatement.\s\sFix\sfor\sticket\s[7d7525cb01b68] -D 2016-04-18T15:46:14.499 +C Fix\sa\slocking\srace\scondition\sin\sWindows\s10\sthat\scan\soccur\swhen\stwo\sor\smore\nprocesses\sattempt\sto\srecover\sthe\ssame\shot\sjournal\sat\sthe\ssame\stime. +D 2016-04-20T18:31:27.150 F Makefile.in eba680121821b8a60940a81454316f47a341487a F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 71b8b16cf9393f68e2e2035486ca104872558836 @@ -360,7 +360,7 @@ F src/os.h 8e976e59eb4ca1c0fca6d35ee803e38951cb0343 F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa F src/os_unix.c d0b41a47eb5f0dc00e423a1723aadeab0e78c85f -F src/os_win.c b169437dff859e308b3726594094a2f8ca922941 +F src/os_win.c 1997a873bfc8296a701bd8e2df8c3d5da5afe956 F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca F src/pager.c 38718a019ca762ba4f6795425d5a54db70d1790d F src/pager.h 329bdf078a4e0a3b35084534d58625d21fd03681 @@ -1482,7 +1482,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3a7d72986fabe9434ff5bd02c93169314f072b23 -R 761e3cafabae5f2f003bf21bdc2befe8 +P eba27d4d17a76884292667d570d542e580ee3e77 +R 91e3493cbc66272eab1ca1f4455591b7 U drh -Z 8a9e64fdc933327d2408de0f01f55efc +Z f74379d7acb8dab3d54fff08dd9ef3d2 diff --git a/manifest.uuid b/manifest.uuid index 540eda5836..b7ae2958b9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -eba27d4d17a76884292667d570d542e580ee3e77 \ No newline at end of file +38a4e9d92887898b779493c71e4500f777a4e2e7 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index 929ad346cc..1f26463453 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -3169,9 +3169,8 @@ static int winLock(sqlite3_file *id, int locktype){ ** the PENDING_LOCK byte is temporary. */ newLocktype = pFile->locktype; - if( (pFile->locktype==NO_LOCK) - || ( (locktype==EXCLUSIVE_LOCK) - && (pFile->locktype==RESERVED_LOCK)) + if( pFile->locktype==NO_LOCK + || (locktype==EXCLUSIVE_LOCK && pFile->locktype<=RESERVED_LOCK) ){ int cnt = 3; while( cnt-->0 && (res = winLockFile(&pFile->h, SQLITE_LOCKFILE_FLAGS, -- 2.47.2