From 062c4a7c72a1b45bc2e37a04b469321c5abc9d97 Mon Sep 17 00:00:00 2001 From: efiacor Date: Wed, 28 Oct 2020 14:56:46 +0000 Subject: [PMSH] Fix thread crash edge case Signed-off-by: efiacor Change-Id: Iebfa05ebc78531191159adf5229ab39082dd1d58 Issue-ID: DCAEGEN2-2501 --- components/pm-subscription-handler/Changelog.md | 5 +++++ .../pm-subscription-handler/pmsh_service/mod/pmsh_utils.py | 9 +++++---- components/pm-subscription-handler/pom.xml | 2 +- components/pm-subscription-handler/setup.py | 2 +- components/pm-subscription-handler/version.properties | 4 ++-- 5 files changed, 14 insertions(+), 8 deletions(-) (limited to 'components') diff --git a/components/pm-subscription-handler/Changelog.md b/components/pm-subscription-handler/Changelog.md index 6e7e0428..09afe1c5 100755 --- a/components/pm-subscription-handler/Changelog.md +++ b/components/pm-subscription-handler/Changelog.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). + +## [1.2.0] +### Changed +* Bug fix prevent sub threads from crashing permanently (DCAEGEN2-2501) + ## [1.1.2] ### Changed * Bug fix for missing sdnc params in DELETE event (DCAEGEN2-2483) diff --git a/components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py b/components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py index 24eade98..c6be38d0 100755 --- a/components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py +++ b/components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py @@ -114,13 +114,11 @@ class AppConfig: """ try: app_conf = self._get_pmsh_config() - if "INVALID JSON" in app_conf.values(): - raise ValueError('Failed to refresh AppConfig: INVALID JSON') self.subscription.administrativeState = app_conf['policy']['subscription'][ 'administrativeState'] logger.info("AppConfig data has been refreshed") except ValueError or Exception as e: - logger.error(e) + logger.error(f'Failed to refresh AppConfig: {e}', exc_info=True) def get_mr_sub(self, sub_name): """ @@ -287,4 +285,7 @@ class PeriodicTask(Timer): def run(self): self.function(*self.args, **self.kwargs) while not self.finished.wait(self.interval): - self.function(*self.args, **self.kwargs) + try: + self.function(*self.args, **self.kwargs) + except Exception as e: + logger.error(f'Exception in thread: {self.name}: {e}', exc_info=True) diff --git a/components/pm-subscription-handler/pom.xml b/components/pm-subscription-handler/pom.xml index b28c6737..fa341a3d 100644 --- a/components/pm-subscription-handler/pom.xml +++ b/components/pm-subscription-handler/pom.xml @@ -32,7 +32,7 @@ org.onap.dcaegen2.services pmsh dcaegen2-services-pm-subscription-handler - 1.1.2-SNAPSHOT + 1.2.0-SNAPSHOT UTF-8 . diff --git a/components/pm-subscription-handler/setup.py b/components/pm-subscription-handler/setup.py index c16323ea..65a07703 100644 --- a/components/pm-subscription-handler/setup.py +++ b/components/pm-subscription-handler/setup.py @@ -21,7 +21,7 @@ from setuptools import setup, find_packages setup( name="pm_subscription_handler", - version="1.1.1", + version="1.2.0", packages=find_packages(), author="lego@est.tech", author_email="lego@est.tech", diff --git a/components/pm-subscription-handler/version.properties b/components/pm-subscription-handler/version.properties index e6eb586c..00ef5645 100644 --- a/components/pm-subscription-handler/version.properties +++ b/components/pm-subscription-handler/version.properties @@ -1,6 +1,6 @@ major=1 -minor=1 -patch=2 +minor=2 +patch=0 base_version=${major}.${minor}.${patch} release_version=${base_version} snapshot_version=${base_version}-SNAPSHOT -- cgit 1.2.3-korg