Community: Framework mailing list archives

expert-framework@mail.odoo.com

On an error...

by
manuel
- 07/30/2015 18:12:15
Hi all,

>From time to time (probably once every two days or less), I'm having an
error.  Complaining about iterating over list that changed.

This is the last portion of the traceback (it can happen with any model,
so that top part always changes)::

  File "openerp/api.py", line 239, in wrapper
    return new_api(self, *args, **kwargs)
  File "openerp/models.py", line 3185, in read
    values[name] = field.convert_to_read(record[name], use_name_get)
  File "openerp/fields.py", line 1552, in convert_to_read
    value_sudo = value.sudo()
  File "openerp/models.py", line 5281, in sudo
    return self.with_env(self.env(user=user))
  File "openerp/api.py", line 737, in __call__
    return Environment(cr, uid, context)
  File "openerp/api.py", line 707, in __new__
    for env in envs:
  File "python2.7/_weakrefset.py", line 60, in __iter__
    for itemref in self.data:
RuntimeError: Set changed size during iteration

I noticed the `envs` holds a local `Environments()` instance.  The
`__iter__` of it, returns an iterator over a `WeakSet`.

I think this is due to gc collecting some of the environments while the
loop is still going on...

Any ideas?

Manuel.