From: stephan Date: Wed, 30 Jul 2025 15:02:32 +0000 (+0000) Subject: Adjust the previous check-in to replace the db's WASM address with yet another random... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1560d52f827a7bb192c580aaa4ff43c533591bbf;p=thirdparty%2Fsqlite.git Adjust the previous check-in to replace the db's WASM address with yet another random number, and increase the range of random numbers, reducing the chance of cross-worker db ID collision to 1 in many billions. FossilOrigin-Name: f5e2a72c57e802c5042ab8343e5009ba9f22ca7138a1c78f4b8201ab9b4fd395 --- diff --git a/ext/wasm/api/sqlite3-api-worker1.c-pp.js b/ext/wasm/api/sqlite3-api-worker1.c-pp.js index 2b5f2da2c3..55ad16185c 100644 --- a/ext/wasm/api/sqlite3-api-worker1.c-pp.js +++ b/ext/wasm/api/sqlite3-api-worker1.c-pp.js @@ -385,8 +385,9 @@ sqlite3.initWorker1API = function(){ const getDbId = function(db){ let id = wState.idMap.get(db); if(id) return id; - id = 'db#'+(++wState.idSeq)+'@'+db.pointer+':'+ - Math.floor(Math.random() * 10000000); + id = 'db#'+(++wState.idSeq)+':'+ + Math.floor(Math.random() * 100000000)+':'+ + Math.floor(Math.random() * 100000000); /** ^^^ can't simply use db.pointer b/c closing/opening may re-use the same address, which could map pending messages to a wrong instance. diff --git a/manifest b/manifest index b9813a3235..e90ea0c658 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C JS:\sadd\sa\srandom\selement\swhen\sassigning\sdb\sIDs\sto\sWorker1\sdb\sinstances.\sThis\saddresses\s[https://github.com/sqlite/sqlite-wasm/issues/113\s|\sthe\snpm\sproject's\sticket\s#113],\swhich\sdemonstrates\sthat\stwo\sindependent\sworkers\scan\send\sup\sgenerating\snon-globally-unique\sIDs.\sThat's\snot\sa\sbug,\sper\sse,\sbut\sit\smakes\sthe\sIDs\suseless\sfor\sclient-side\smapping\sof\sdb\sconnection\sIDs\sto\sclient-side\sstate,\sso\swe\sadd\ssome\srandomness\sto\sthem. -D 2025-07-30T14:50:44.181 +C Adjust\sthe\sprevious\scheck-in\sto\sreplace\sthe\sdb's\sWASM\saddress\swith\syet\sanother\srandom\snumber,\sand\sincrease\sthe\srange\sof\srandom\snumbers,\sreducing\sthe\schance\sof\scross-worker\sdb\sID\scollision\sto\s1\sin\smany\sbillions. +D 2025-07-30T15:02:32.895 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -644,7 +644,7 @@ F ext/wasm/api/sqlite3-api-cleanup.js 3ac1786e461ada63033143be8c3b00b26b93954066 F ext/wasm/api/sqlite3-api-glue.c-pp.js 0b76510f3650053bac67ca8947cb6ab9d050ad2218118a2e7796dd37be832ffa F ext/wasm/api/sqlite3-api-oo1.c-pp.js 852f2cd6acddbae487fc4f1c3ec952e6c1e2033aa4e6c7091d330d983c87c032 F ext/wasm/api/sqlite3-api-prologue.js 4f1c2a9dc9caf631907766e9872c27d11b255ccae779e8af01c7f8b932817214 -F ext/wasm/api/sqlite3-api-worker1.c-pp.js 41733b659a6f51438947c3c1e276e5ea48f7b0926904d98537ad2d77a109457f +F ext/wasm/api/sqlite3-api-worker1.c-pp.js 760191cd13416e6f5adfd9fcc8a97fed5645c9e0a5fbac213a2d4ce2d79a4334 F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89 F ext/wasm/api/sqlite3-opfs-async-proxy.js 9654b565b346dc609b75d15337f20acfa7af7d9d558da1afeb9b6d8eaa404966 F ext/wasm/api/sqlite3-vfs-helper.c-pp.js 3f828cc66758acb40e9c5b4dcfd87fd478a14c8fb7f0630264e6c7fa0e57515d @@ -2213,8 +2213,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 09e1d7c7b4615262dd03adf1be201122f3cb8909ad381d67f51c812f07e25719 -R 23a16f28102ef2a710420716877b61c9 +P 6d2a43075fda9c4eae28f9ca4aaf459c41d305c861947a47fb2cbd513249c4b9 +R f915f285b72eb6ae8f21e175cf12c94f U stephan -Z eda584cf2bd578a7e7092d276d114db7 +Z 50a318d35c1473bfa60947fbe8367fb4 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 1ad1906897..9dc63cd4cf 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6d2a43075fda9c4eae28f9ca4aaf459c41d305c861947a47fb2cbd513249c4b9 +f5e2a72c57e802c5042ab8343e5009ba9f22ca7138a1c78f4b8201ab9b4fd395