Closed drawks closed 3 years ago
After playing with this a little bit, I think the issue may be that __slots__
doesn't seem to actually do anything on python2 when using "old style" classes. Where python3 automatically creates "new style" classes regardless of the syntax. So on python2 both Interval
and IntervalSet
has a __dict__
attribute even though they have __slots__
defined. When you go to unpickle on python3 the shape of the object isn't the same any longer since the python3 version properly applies the __slots__
and expects an object with no __dict__
attribute.
Describe the bug The pickled data returned from the
/metrics/find
endpoint of graphite-web running on python2 cannot be unpickled by graphite-web running on python3.To Reproduce While this can be observed by configuring an instance of graphite-web running on python 3 to point to any graphite-web hosts running on python2 as their "cluster servers". The minimal reproducible bug is easily arrived at in the python repl
Expected behavior I would expect that regardless of python version being run on graphite-web hosts that the wire protocols used to between them would be compatible.
Environment (please complete the following information):
Additional context The cause of this seems to be a difference in how slotted objects are stored in python2 and python3. If you modify the
Interval
andIntervalSet
class definitions to not use slots the objects unpickle just fine on python3. A side effect of this problem is that graphite-web on python3 is incompatible with other graphite-web implementations (carbonapi for example) which use pickled objects that copy the official graphite-web.While it seems unlikely that there are many mixed python2/3 graphite-web clusters in the wild there definitely are people using graphite-web as a front end to carbonapi that will be surprised to find that graphite-web running on python3 will not work for them.