details: https://code.tryton.org/tryton/commit/d09f4b4b8b5a
branch: default
user: Cédric Krier <[email protected]>
date: Mon Jul 27 12:10:00 2026 +0200
description:
Protect writing configuration of tryton with a thread lock
Closes #6114
diffstat:
tryton/tryton/config.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diffs (31 lines):
diff -r 909040ff6368 -r d09f4b4b8b5a tryton/tryton/config.py
--- a/tryton/tryton/config.py Fri Jul 24 15:17:04 2026 +0200
+++ b/tryton/tryton/config.py Mon Jul 27 12:10:00 2026 +0200
@@ -9,6 +9,7 @@
import shutil
import sys
from tempfile import NamedTemporaryFile
+from threading import Lock
from gi.repository import GdkPixbuf
@@ -16,6 +17,7 @@
logger = logging.getLogger(__name__)
_ = gettext.gettext
+_lock = Lock()
def _reverse_series_iterator(starting_version):
@@ -172,8 +174,9 @@
if not parser.has_section(section):
parser.add_section(section)
parser.set(section, name, str(self.config[entry]))
- with open(self.rcfile, 'w') as fp:
- parser.write(fp)
+ with _lock:
+ with open(self.rcfile, 'w') as fp:
+ parser.write(fp)
except IOError:
logger.warn("Unable to write config file %s", self.rcfile)
return False