Community: Framework mailing list archives

expert-framework@mail.odoo.com

Re: On an error...

by
Leonardo Pistone
- 07/31/2015 04:34:30
Hi Manuel,

I don't know myself, but for this kind of low-level bugs in the
framework, you can try too create an issue on odoo/odoo and kindly
ping Raphaël Collet @rco-odoo (he is the main author of the new new
API).

On Fri, Jul 31, 2015 at 12:18 AM, Manuel Vázquez <manuel@merchise.org> wrote:
> 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.