Technical mailing list archives

On an error...

- 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/", line 239, in wrapper
    return new_api(self, *args, **kwargs)
  File "openerp/", line 3185, in read
    values[name] = field.convert_to_read(record[name], use_name_get)
  File "openerp/", line 1552, in convert_to_read
    value_sudo = value.sudo()
  File "openerp/", line 5281, in sudo
    return self.with_env(self.env(user=user))
  File "openerp/", line 737, in __call__
    return Environment(cr, uid, context)
  File "openerp/", line 707, in __new__
    for env in envs:
  File "python2.7/", line 60, in __iter__
    for itemref in
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?