From 9b3c8f34a92e62ce5ba13a10dd9e02f3a3105188 Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Wed, 26 Jul 2017 17:52:47 +0300 Subject: [PATCH] Add debug log to indicate when external lock is taken In a case when a number of threads are concurrently accessing a resource that has a external lock there is no indication when one of the threads has taken the external lock. This patch adds in a debug log to try and add some clarity. Change-Id: Ibd7cfd3b39370b1a54f2ab50c75c6b92a876ae1a --- oslo_concurrency/lockutils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/oslo_concurrency/lockutils.py b/oslo_concurrency/lockutils.py index becda88..e896a1a 100644 --- a/oslo_concurrency/lockutils.py +++ b/oslo_concurrency/lockutils.py @@ -214,6 +214,9 @@ def lock(name, lock_file_prefix=None, external=False, lock_path=None, if external and not CONF.oslo_concurrency.disable_process_locking: ext_lock = external_lock(name, lock_file_prefix, lock_path) ext_lock.acquire(delay=delay) + if do_log: + LOG.debug('Acquired external semaphore "%(lock)s"', + {'lock': name}) try: yield ext_lock finally: