[oslo][nova] Revert of oslo.messaging JSON serialization change

Ben Nemec openstack at nemebean.com
Mon Sep 30 14:45:16 UTC 2019


Hi,

I've just proposed https://review.opendev.org/#/c/685724/ which reverts 
a change that recently went in to make the fake driver in oslo.messaging 
use jsonutils for message serialization instead of json.dumps.

As explained in the commit message on the revert, this is problematic 
because the rabbit driver uses kombu's default serialization method, 
which is json.dumps. By changing the fake driver to use jsonutils we've 
made it more lenient than the most used real driver which opens us up to 
merging broken changes in consumers of oslo.messaging.

We did have some discussion of whether we should try to override the 
kombu default and tell it to use jsonutils too, as a number of other 
drivers do. The concern with this was that the jsonutils handler for 
things like datetime objects is not tz-aware, which means if you send a 
datetime object over RPC and don't explicitly handle it you could lose 
important information.

I'm open to being persuaded otherwise, but at the moment I'm leaning 
toward less magic happening at the RPC layer and requiring projects to 
explicitly handle types that aren't serializable by the standard library 
json module. If you have a different preference, please share it here.

Thanks.

-Ben



More information about the openstack-discuss mailing list