summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichal Minar <miminar@redhat.com>2013-02-13 19:48:45 +0100
committerMichal Minar <miminar@redhat.com>2013-02-13 20:02:50 +0100
commit73125fe7a43b560ec230004199ecd60690f9d063 (patch)
tree875070cc48d4ce7cbbb2bbf6e6242d17882d3611 /src
parent6af9610a5ac5f2d6b2473ae40a5029a72652f92d (diff)
downloadopenlmi-providers-73125fe7a43b560ec230004199ecd60690f9d063.tar.gz
openlmi-providers-73125fe7a43b560ec230004199ecd60690f9d063.tar.xz
openlmi-providers-73125fe7a43b560ec230004199ecd60690f9d063.zip
fixed wrong thread synchronization
job could not be finished on rare occasions
Diffstat (limited to 'src')
-rw-r--r--src/software/openlmi/software/yumdb/__init__.py11
-rw-r--r--src/software/openlmi/software/yumdb/process.py4
2 files changed, 11 insertions, 4 deletions
diff --git a/src/software/openlmi/software/yumdb/__init__.py b/src/software/openlmi/software/yumdb/__init__.py
index dc77689..2f41783 100644
--- a/src/software/openlmi/software/yumdb/__init__.py
+++ b/src/software/openlmi/software/yumdb/__init__.py
@@ -132,12 +132,13 @@ class YumDB(singletonmixin.Singleton):
@return result of job
"""
with self._reply_lock:
- # until our job is not at the head of
self._expected.append(job.jobid)
- while job.jobid != self._expected[0]:
+ while True:
if job.jobid in self._replies:
self._expected.remove(job.jobid)
return self._replies.pop(job.jobid)
+ elif job.jobid == self._expected[0]:
+ break
else:
cmpi_logging.logger.debug(
"[jobid=%d] another %s threads expecting reply,"
@@ -201,9 +202,11 @@ class YumDB(singletonmixin.Singleton):
uplink = JoinableQueue()
downlink = Queue()
self._process = YumWorker(uplink, downlink,
- yum_args=self._yum_args[0], yum_kwargs=self._yum_args[1])
- #logging_config=YUM_WORKER_DEBUG_LOGGING_CONFIG)
+ yum_args=self._yum_args[0], yum_kwargs=self._yum_args[1],
+ logging_config=YUM_WORKER_DEBUG_LOGGING_CONFIG)
self._process.start()
+ cmpi_logging.logger.trace_info(
+ "YumDB: YumWorker started with pid=%s", self._process.pid)
return self._process
# *************************************************************************
diff --git a/src/software/openlmi/software/yumdb/process.py b/src/software/openlmi/software/yumdb/process.py
index cd70407..daef180 100644
--- a/src/software/openlmi/software/yumdb/process.py
+++ b/src/software/openlmi/software/yumdb/process.py
@@ -436,7 +436,10 @@ class YumWorker(Process):
what = 'all'
else:
what = kind
+ _logger().debug("calling YumBase.doPackageLists(%s, showdups=%s)",
+ what, allow_duplicates)
pkglist = self._yum_base.doPackageLists(what, showdups=allow_duplicates)
+ _logger().debug("YumBase.doPackageLists() finished")
if kind == 'all':
result = pkglist.available + pkglist.installed
elif kind == 'available':
@@ -585,6 +588,7 @@ class YumWorker(Process):
except Exception: #pylint: disable=W0703
# logging is not set up but client expects us to work
pass
+ _logger().info("running as pid=%d", self.pid)
_logger().info("starting %s main loop", self.__class__.__name__)
self._pkg_cache = weakref.WeakValueDictionary()
while True: