Comment 6 for bug 1673375

Revision history for this message
Shunli Zhou (shunliz) wrote :

jsonutils check the "Circular reference" as below:
      if markers is not None:
                markerid = id(o)
                if markerid in markers:
                    raise ValueError("Circular reference detected")
                markers[markerid] = o
..................
       if markers is not None:
                del markers[markerid]

Did some simple tests as below:
>>> from oslo_db.sqlalchemy.enginefacade import _Default
>>>
>>>
>>> d1 = _Default()
>>> d2 = _Default()
>>> id(d1)
140398845648296
>>> id(d2)
44938024
>>> d2 = _Default(5)
>>> d1 = _Default(5)
>>> id(d2)
44938080
>>> id(d1)
44938136

Seems oslo_db.sqlalchemy.enginefacade._Default instances's id() may not collision each other.

But according to jsonutils.dump source code, it seems only the oslo_db.sqlalchemy.enginefacade._Default instances'id may collision each other and cause "Circular reference".

Maybe #5 can solve this bug.