summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Laplante <chris.laplante@agilent.com>2020-01-16 11:28:05 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-01-19 13:31:05 +0000
commit1b1a533133e68b1850cd4194d51b53e819fa9183 (patch)
treeaf9550485e98804578176a9394d176b787d1977c
parent96adf215cca17bc1fed40de635139b3422ba6fde (diff)
downloadpoky-1b1a533133e68b1850cd4194d51b53e819fa9183.tar.gz
bitbake: persist_data.py: Immediately get exclusive lock in __setitem__
To avoid races, SQLTable::__setitem__ needs an exclusive lock for the entire transaction, not just the INSERT/UPDATE part. (Bitbake rev: feb43e7c30f5bfab75d718896c45df621810d06f) Signed-off-by: Chris Laplante <chris.laplante@agilent.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/persist_data.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/bitbake/lib/bb/persist_data.py b/bitbake/lib/bb/persist_data.py
index de8f87a8bf..7357ab2d44 100644
--- a/bitbake/lib/bb/persist_data.py
+++ b/bitbake/lib/bb/persist_data.py
@@ -179,6 +179,9 @@ class SQLTable(collections.MutableMapping):
179 elif not isinstance(value, str): 179 elif not isinstance(value, str):
180 raise TypeError('Only string values are supported') 180 raise TypeError('Only string values are supported')
181 181
182 # Ensure the entire transaction (including SELECT) executes under write lock
183 cursor.execute("BEGIN EXCLUSIVE")
184
182 cursor.execute("SELECT * from %s where key=?;" % self.table, [key]) 185 cursor.execute("SELECT * from %s where key=?;" % self.table, [key])
183 row = cursor.fetchone() 186 row = cursor.fetchone()
184 if row is not None: 187 if row is not None: