commit 019f0155481489a766f07f981f4df2e64d9fd3f9 Author: Gregory Thiemonge Date: Wed Sep 30 21:26:34 2020 +0200 Fix python2 AttributeError with strptime Fix a potential python2 error when calling strptime, the first call to strptime is not thread safe and might trigger an exception. A workaround was added by calling strptime before creating a thread but the caller is itself within a thread, so it may fail. The workaround is now to explicitly import _strptime as described in the upstream python issue https://bugs.python.org/issue7980 Note: This commit only applies to branches that support python2 (initial commit in stable/train) Story 2008211 Task 40997 Change-Id: I0e7119d5a379f8662c4913d7232ef28535a29b32 (cherry picked from commit 5a69da392f8951fa3716c81f81f1ecaf5dfe3480) diff --git a/octavia/common/base_taskflow.py b/octavia/common/base_taskflow.py index 4fb3e3a..1d072cc 100644 --- a/octavia/common/base_taskflow.py +++ b/octavia/common/base_taskflow.py @@ -16,6 +16,9 @@ import concurrent.futures import datetime +# work around for https://bugs.python.org/issue7980 +import _strptime # noqa: F401 pylint: disable=unused-import + from oslo_config import cfg from taskflow import engines as tf_engines diff --git a/releasenotes/notes/fix-python2-attributeerror-strptime-89a7350c55ac8818.yaml b/releasenotes/notes/fix-python2-attributeerror-strptime-89a7350c55ac8818.yaml new file mode 100644 index 0000000..95eaf05 --- /dev/null +++ b/releasenotes/notes/fix-python2-attributeerror-strptime-89a7350c55ac8818.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fix a potential AttributeError exception at init time in the housekeeping + service when using python2 because of an issue with thread safety when + calling strptime for the first time.