The sqlalchemy backend uses JSONType from sqlalchemy_utils that does simple json.dumps on the object w/o any fallbacks for serialization. This may lead to unserializable entities slipping in, leading to StorageFailure.
As an example, this is a traceback from Masakari failing to call Nova, with MaxRetryError bubbling up all the way down from urllib3
2021-07-06 10:24:01,257 1 DEBUG masakari.compute.nova [req-93e72eca-fe30-4561-a722-084cda651369 admin - - - -] Creating a Nova client using "admin" user novaclient /var/lib/openstack/lib/python3.6/site-packages/masakari/compute/nova.py:103
2021-07-06 10:24:18,047 1 ERROR taskflow.engines.action_engine.builder [req-93e72eca-fe30-4561-a722-084cda651369 admin - - - -] Engine 'DisableComputeServiceTask==1.0' atom post-completion failed: tenacity.RetryError: RetryError[<Future at 0x7f1affd3b5f8 state=finished raised StorageFailure>]
2021-07-06 10:24:18,047 1 ERROR taskflow.engines.action_engine.builder Traceback (most recent call last):
2021-07-06 10:24:18,047 1 ERROR taskflow.engines.action_engine.builder File "/var/lib/openstack/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1204, in _execute_context
2021-07-06 10:24:18,047 1 ERROR taskflow.engines.action_engine.builder context = constructor(dialect, self, conn, *args)
2021-07-06 10:24:18,047 1 ERROR taskflow.engines.action_engine.builder File "/var/lib/openstack/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 865, in _init_compiled
2021-07-06 10:24:18,047 1 ERROR taskflow.engines.action_engine.builder for key in compiled_params
2021-07-06 10:24:18,047 1 ERROR taskflow.engines.action_engine.builder File "/var/lib/openstack/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 865, in <genexpr>
2021-07-06 10:24:18,047 1 ERROR taskflow.engines.action_engine.builder for key in compiled_params
2021-07-06 10:24:18,047 1 ERROR taskflow.engines.action_engine.builder File "/var/lib/openstack/lib/python3.6/site-packages/sqlalchemy/sql/type_api.py", line 1230, in process
2021-07-06 10:24:18,047 1 ERROR taskflow.engines.action_engine.builder return impl_processor(process_param(value, dialect))
2021-07-06 10:24:18,047 1 ERROR taskflow.engines.action_engine.builder File "/var/lib/openstack/lib/python3.6/site-packages/sqlalchemy_utils/types/json.py", line 80, in process_bind_param
2021-07-06 10:24:18,047 1 ERROR taskflow.engines.action_engine.builder value = six.text_type(json.dumps(value))
2021-07-06 10:24:18,047 1 ERROR taskflow.engines.action_engine.builder File "/usr/lib/python3.6/json/__init__.py", line 231, in dumps
2021-07-06 10:24:18,047 1 ERROR taskflow.engines.action_engine.builder return _default_encoder.encode(obj)
2021-07-06 10:24:18,047 1 ERROR taskflow.engines.action_engine.builder File "/usr/lib/python3.6/json/encoder.py", line 199, in encode
2021-07-06 10:24:18,047 1 ERROR taskflow.engines.action_engine.builder chunks = self.iterencode(o, _one_shot=True)
2021-07-06 10:24:18,047 1 ERROR taskflow.engines.action_engine.builder File "/usr/lib/python3.6/json/encoder.py", line 257, in iterencode
2021-07-06 10:24:18,047 1 ERROR taskflow.engines.action_engine.builder return _iterencode(o, 0)
2021-07-06 10:24:18,047 1 ERROR taskflow.engines.action_engine.builder File "/usr/lib/python3.6/json/encoder.py", line 180, in default
2021-07-06 10:24:18,047 1 ERROR taskflow.engines.action_engine.builder o.__class__.__name__)
2021-07-06 10:24:18,047 1 ERROR taskflow.engines.action_engine.builder TypeError: Object of type 'MaxRetryError' is not JSON serializable
I am not sure if it is only taskflow library consumers job to sanitize the inputs for the lib, and think taskflow could do somewhat better too in this regard.
patch proposed https:/ /review. opendev. org/c/openstack /taskflow/ +/800609
subclass JSONType form sqlalchemy_utils and override couple of methods there to use oslo_serializat ion.jsonutils for JSON dumping and loading
this one should be more reliable than sqla_utils.JSONType as it better handles complex data, and at least provides 'str' as default fallback function when serializing.