In lsm (not SQLite), avoid opening the *-shm file before the database file is
locked. Otherwise, there is a race condition whereby a connection in another process process may unlink() it while it is still in use. FossilOrigin-Name: c8b8b9b573665c2b4d278bb679a48ac407374b8d860f0c3f4d50a303043464ad
This commit is contained in:
parent
f970372698
commit
b5ef728db6
@ -340,9 +340,6 @@ static int doDbConnect(lsm_db *pDb){
|
||||
/* Obtain a pointer to the shared-memory header */
|
||||
assert( pDb->pShmhdr==0 );
|
||||
assert( pDb->bReadonly==0 );
|
||||
rc = lsmShmCacheChunks(pDb, 1);
|
||||
if( rc!=LSM_OK ) return rc;
|
||||
pDb->pShmhdr = (ShmHeader *)pDb->apShm[0];
|
||||
|
||||
/* Block for an exclusive lock on DMS1. This lock serializes all calls
|
||||
** to doDbConnect() and doDbDisconnect() across all processes. */
|
||||
@ -353,10 +350,11 @@ static int doDbConnect(lsm_db *pDb){
|
||||
nUs = nUs * 2;
|
||||
if( nUs>nUsMax ) nUs = nUsMax;
|
||||
}
|
||||
if( rc!=LSM_OK ){
|
||||
pDb->pShmhdr = 0;
|
||||
return rc;
|
||||
if( rc==LSM_OK ){
|
||||
rc = lsmShmCacheChunks(pDb, 1);
|
||||
}
|
||||
if( rc!=LSM_OK ) return rc;
|
||||
pDb->pShmhdr = (ShmHeader *)pDb->apShm[0];
|
||||
|
||||
/* Try an exclusive lock on DMS2/DMS3. If successful, this is the first
|
||||
** and only connection to the database. In this case initialize the
|
||||
|
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C Fix\sminor\stest\sscript\sproblems\srevealed\sby\sreleasetest.tcl.
|
||||
D 2017-10-23T07:52:07.660
|
||||
C In\slsm\s(not\sSQLite),\savoid\sopening\sthe\s*-shm\sfile\sbefore\sthe\sdatabase\sfile\sis\nlocked.\sOtherwise,\sthere\sis\sa\srace\scondition\swhereby\sa\sconnection\sin\sanother\nprocess\sprocess\smay\sunlink()\sit\swhile\sit\sis\sstill\sin\suse.
|
||||
D 2017-10-23T11:48:00.248
|
||||
F Makefile.in e016061b23e60ac9ec27c65cb577292b6bde0307ca55abd874ab3487b3b1beb2
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 37740aba9c4bb359c627eadccf1cfd7be4f5f847078723777ea7763969e533b1
|
||||
@ -245,7 +245,7 @@ F ext/lsm1/lsm_log.c a8bf334532109bba05b09a504ee45fc393828b0d034ca61ab45e3940709
|
||||
F ext/lsm1/lsm_main.c 15e73ccdafdd44ddeefc29e332079d88ba8f00c12c797b3c2b63d3171b5afce8
|
||||
F ext/lsm1/lsm_mem.c 4c51ea9fa285ee6e35301b33491642d071740a0a
|
||||
F ext/lsm1/lsm_mutex.c 378edf0a2b142b4f7640ee982df06d50b98788ea
|
||||
F ext/lsm1/lsm_shared.c 5bc37768e558492f60d7196735ddd54843cd239bd66c1af6eb205a6348ca5e46
|
||||
F ext/lsm1/lsm_shared.c 1a76b7a5e89a003c24d58f1fb295c4203b48ef6acba9a194ac6003ade09fcd47
|
||||
F ext/lsm1/lsm_sorted.c a04518dfbfff0171fafb152a46e9fe9f45e1edbf3570e4533dd58ddb6567f0c9
|
||||
F ext/lsm1/lsm_str.c 65e361b488c87b10bf3e5c0070b14ffc602cf84f094880bece77bbf6678bca82
|
||||
F ext/lsm1/lsm_tree.c 682679d7ef2b8b6f2fe77aeb532c8d29695bca671c220b0abac77069de5fb9fb
|
||||
@ -1664,7 +1664,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 0fcf1e61ef2b6c1fb8f4846f973d2d427598ffbc80dbc49e56e71513b194bae7
|
||||
R e3bec412c3fcc940b80e7c9735d18bbe
|
||||
P 15e87d9bc81812fb9de86f9870389217dddb9f9c4d48e42acefce2d35ba293f1
|
||||
R 788a72b4e4bc49507efed4d645930eed
|
||||
U dan
|
||||
Z a4aaac778f287d83315a30f9e1092784
|
||||
Z 97cc68bc0ee206aadd31e81854de499f
|
||||
|
@ -1 +1 @@
|
||||
15e87d9bc81812fb9de86f9870389217dddb9f9c4d48e42acefce2d35ba293f1
|
||||
c8b8b9b573665c2b4d278bb679a48ac407374b8d860f0c3f4d50a303043464ad
|
Loading…
x
Reference in New Issue
Block a user