[PMSH] Fix thread crash edge case 63/114363/3
authorefiacor <fiachra.corcoran@est.tech>
Wed, 28 Oct 2020 14:56:46 +0000 (14:56 +0000)
committerefiacor <fiachra.corcoran@est.tech>
Wed, 18 Nov 2020 09:49:09 +0000 (09:49 +0000)
Signed-off-by: efiacor <fiachra.corcoran@est.tech>
Change-Id: Iebfa05ebc78531191159adf5229ab39082dd1d58
Issue-ID: DCAEGEN2-2501

components/pm-subscription-handler/Changelog.md
components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py
components/pm-subscription-handler/pom.xml
components/pm-subscription-handler/setup.py
components/pm-subscription-handler/version.properties

index 6e7e042..09afe1c 100755 (executable)
@@ -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)
index 24eade9..c6be38d 100755 (executable)
@@ -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)
index b28c673..fa341a3 100644 (file)
@@ -32,7 +32,7 @@
   <groupId>org.onap.dcaegen2.services</groupId>
   <artifactId>pmsh</artifactId>
   <name>dcaegen2-services-pm-subscription-handler</name>
-  <version>1.1.2-SNAPSHOT</version>
+  <version>1.2.0-SNAPSHOT</version>
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <sonar.sources>.</sonar.sources>
index c16323e..65a0770 100644 (file)
@@ -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",
index e6eb586..00ef564 100644 (file)
@@ -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