OpenUpgrade icon indicating copy to clipboard operation
OpenUpgrade copied to clipboard

[13.0] `MemoryError` in `website_sale` `post-migration` with many images

Open huguesdk opened this issue 11 months ago • 18 comments

module

website_sale

describe the bug

when running a migration from 12.0 to 13.0 with many product.image records, the migration fails after displaying many MemoryError errors.

to reproduce

affected versions: upgrade to 13.0

steps to reproduce the behavior:

  1. have a database in version 12.0 with website_sale installed and having many product.image records (in my case, 21k).
  2. run openupgrade to upgrade to 13.0.

expected behavior the database and its filestore should be correctly upgraded to 13.0.

additional context

log:

2025-01-15 17:21:08,640 1 INFO odoo-upgrade odoo.modules.migration: module website_sale: Running migration [13.0.1.0>] post-migration 
2025-01-15 17:21:08,643 1 INFO odoo-upgrade OpenUpgrade: website_sale: post-migration script called with version 12.0.1.0 
2025-01-15 17:21:08,643 1 INFO odoo-upgrade odoo.models: Computing parent_path for table product_public_category... 
2025-01-15 17:21:08,659 1 DEBUG odoo-upgrade OpenUpgrade: 0 rows affected after 0:00:00.003386 running 
        UPDATE product_image
        SET name = 'Image ' || id
        WHERE name IS NULL  
2025-01-15 17:23:14,217 1 ERROR odoo-upgrade post-migration: Error while recovering product.image>image for 19497: MemoryError() 
2025-01-15 17:23:14,234 1 ERROR odoo-upgrade post-migration: Error while recovering product.image>image for 19496: MemoryError() 
2025-01-15 17:23:14,235 1 ERROR odoo-upgrade post-migration: Error while recovering product.image>image for 19495: MemoryError() 
2025-01-15 17:23:14,236 1 ERROR odoo-upgrade post-migration: Error while recovering product.image>image for 19494: MemoryError() 
2025-01-15 17:23:14,238 1 ERROR odoo-upgrade post-migration: Error while recovering product.image>image for 19493: MemoryError() 
2
(…)
2025-01-15 17:23:20,981 1 ERROR odoo-upgrade post-migration: Error while recovering product.image>image for 15232: MemoryError() 
2025-01-15 17:23:20,982 1 ERROR odoo-upgrade post-migration: Error while recovering product.image>image for 15231: MemoryError() 
2025-01-15 17:23:20,983 1 ERROR odoo-upgrade post-migration: Error while recovering product.image>image for 15230: MemoryError() 
2025-01-15 17:23:21,010 1 ERROR odoo-upgrade OpenUpgrade: website_sale: error in migration script /odoo_env/src/openupgrade/addons/website_sale/migrations/13.0.1.0/post-migration.py:  
2025-01-15 17:23:21,010 1 ERROR odoo-upgrade OpenUpgrade:  
Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/odoo/api.py", line 748, in get
    value = self._data[field][record._ids[0]]
KeyError: 139810

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1038, in __get__
    value = env.cache.get(record, self)
  File "/odoo_env/src/openupgrade/odoo/api.py", line 754, in get
    raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: ('ir.attachment(139810,).datas', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/odoo/api.py", line 748, in get
    value = self._data[field][record._ids[0]]
KeyError: 139810

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1038, in __get__
    value = env.cache.get(record, self)
  File "/odoo_env/src/openupgrade/odoo/api.py", line 754, in get
    raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: ('ir.attachment(139810,).store_fname', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1147, in compute_value
    records._compute_field_value(self)
  File "/odoo_env/src/openupgrade/odoo/models.py", line 4021, in _compute_field_value
    getattr(self, field.compute)()
  File "/odoo_env/src/openupgrade/odoo/addons/base/models/ir_attachment.py", line 199, in _compute_datas
    if attach.store_fname:
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1045, in __get__
    recs._fetch_field(self)
  File "/odoo_env/src/openupgrade/odoo/models.py", line 3006, in _fetch_field
    self._read(fnames)
  File "/odoo_env/src/openupgrade/odoo/addons/base/models/ir_attachment.py", line 486, in _read
    return super(IrAttachment, self)._read(fields)
  File "/odoo_env/src/openupgrade/odoo/models.py", line 3099, in _read
    self.env.cache.update(fetched, field, values)
  File "/odoo_env/src/openupgrade/odoo/api.py", line 773, in update
    self._data[field].update(zip(records._ids, values))
MemoryError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/addons/website_sale/migrations/13.0.1.0/post-migration.py", line 32, in convert_image_attachments
    Model.browse(attachment.res_id).image_1920 = attachment.datas
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1062, in __get__
    self.compute_value(recs)
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 2001, in compute_value
    super().compute_value(records)
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1150, in compute_value
    env.add_to_compute(field, records)
  File "/odoo_env/src/openupgrade/odoo/api.py", line 690, in add_to_compute
    self.all.tocompute[field].update(records._ids)
MemoryError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/odoo/api.py", line 748, in get
    value = self._data[field][record._ids[0]]
KeyError: 139810

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1038, in __get__
    value = env.cache.get(record, self)
  File "/odoo_env/src/openupgrade/odoo/api.py", line 754, in get
    raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: ('ir.attachment(139810,).res_id', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/venv/lib/python3.7/site-packages/openupgradelib/openupgrade.py", line 2285, in wrapped_function
    version,
  File "/odoo_env/src/openupgrade/addons/website_sale/migrations/13.0.1.0/post-migration.py", line 66, in migrate
    convert_image_attachments(env)
  File "/odoo_env/src/openupgrade/addons/website_sale/migrations/13.0.1.0/post-migration.py", line 38, in convert_image_attachments
    attachment.res_id,
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1045, in __get__
    recs._fetch_field(self)
  File "/odoo_env/src/openupgrade/odoo/models.py", line 3006, in _fetch_field
    self._read(fnames)
  File "/odoo_env/src/openupgrade/odoo/addons/base/models/ir_attachment.py", line 486, in _read
    return super(IrAttachment, self)._read(fields)
  File "/odoo_env/src/openupgrade/odoo/models.py", line 3099, in _read
    self.env.cache.update(fetched, field, values)
  File "/odoo_env/src/openupgrade/odoo/api.py", line 773, in update
    self._data[field].update(zip(records._ids, values))
MemoryError
2025-01-15 17:23:21,082 1 ERROR odoo-upgrade odoo.modules.loading: Error executing post migration script for module website_sale
`-> website_sale_management
`-> website_sale_product_description
`-> website_sale_product_sort
`-> website_sale_product_style_badge
`-> website_sale_require_legal
:  
2025-01-15 17:23:21,086 1 ERROR odoo-upgrade odoo.modules.registry: Failed to load registry 
Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/odoo/api.py", line 748, in get
    value = self._data[field][record._ids[0]]
KeyError: 139810

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1038, in __get__
    value = env.cache.get(record, self)
  File "/odoo_env/src/openupgrade/odoo/api.py", line 754, in get
    raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: ('ir.attachment(139810,).datas', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/odoo/api.py", line 748, in get
    value = self._data[field][record._ids[0]]
KeyError: 139810

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1038, in __get__
    value = env.cache.get(record, self)
  File "/odoo_env/src/openupgrade/odoo/api.py", line 754, in get
    raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: ('ir.attachment(139810,).store_fname', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1147, in compute_value
    records._compute_field_value(self)
  File "/odoo_env/src/openupgrade/odoo/models.py", line 4021, in _compute_field_value
    getattr(self, field.compute)()
  File "/odoo_env/src/openupgrade/odoo/addons/base/models/ir_attachment.py", line 199, in _compute_datas
    if attach.store_fname:
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1045, in __get__
    recs._fetch_field(self)
  File "/odoo_env/src/openupgrade/odoo/models.py", line 3006, in _fetch_field
    self._read(fnames)
  File "/odoo_env/src/openupgrade/odoo/addons/base/models/ir_attachment.py", line 486, in _read
    return super(IrAttachment, self)._read(fields)
  File "/odoo_env/src/openupgrade/odoo/models.py", line 3099, in _read
    self.env.cache.update(fetched, field, values)
  File "/odoo_env/src/openupgrade/odoo/api.py", line 773, in update
    self._data[field].update(zip(records._ids, values))
MemoryError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/addons/website_sale/migrations/13.0.1.0/post-migration.py", line 32, in convert_image_attachments
    Model.browse(attachment.res_id).image_1920 = attachment.datas
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1062, in __get__
    self.compute_value(recs)
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 2001, in compute_value
    super().compute_value(records)
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1150, in compute_value
    env.add_to_compute(field, records)
  File "/odoo_env/src/openupgrade/odoo/api.py", line 690, in add_to_compute
    self.all.tocompute[field].update(records._ids)
MemoryError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/odoo/api.py", line 748, in get
    value = self._data[field][record._ids[0]]
KeyError: 139810

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1038, in __get__
    value = env.cache.get(record, self)
  File "/odoo_env/src/openupgrade/odoo/api.py", line 754, in get
    raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: ('ir.attachment(139810,).res_id', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/odoo/modules/registry.py", line 87, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/odoo_env/src/openupgrade/odoo/modules/loading.py", line 489, in load_modules
    force, status, report, loaded_modules, update_module, models_to_check, upg_registry)
  File "/odoo_env/src/openupgrade/odoo/modules/loading.py", line 368, in load_marked_modules
    upg_registry=upg_registry,
  File "/odoo_env/src/openupgrade/odoo/modules/loading.py", line 256, in load_module_graph
    migrations.migrate_module(package, 'post')
  File "/odoo_env/src/openupgrade/odoo/modules/migration.py", line 191, in migrate_module
    migrate(self.cr, installed_version)
  File "/opt/venv/lib/python3.7/site-packages/openupgradelib/openupgrade.py", line 2285, in wrapped_function
    version,
  File "/odoo_env/src/openupgrade/addons/website_sale/migrations/13.0.1.0/post-migration.py", line 66, in migrate
    convert_image_attachments(env)
  File "/odoo_env/src/openupgrade/addons/website_sale/migrations/13.0.1.0/post-migration.py", line 38, in convert_image_attachments
    attachment.res_id,
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1045, in __get__
    recs._fetch_field(self)
  File "/odoo_env/src/openupgrade/odoo/models.py", line 3006, in _fetch_field
    self._read(fnames)
  File "/odoo_env/src/openupgrade/odoo/addons/base/models/ir_attachment.py", line 486, in _read
    return super(IrAttachment, self)._read(fields)
  File "/odoo_env/src/openupgrade/odoo/models.py", line 3099, in _read
    self.env.cache.update(fetched, field, values)
  File "/odoo_env/src/openupgrade/odoo/api.py", line 773, in update
    self._data[field].update(zip(records._ids, values))
MemoryError
2025-01-15 17:23:21,087 1 CRITICAL odoo-upgrade odoo.service.server: Failed to initialize database `odoo-upgrade`. 
Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/odoo/api.py", line 748, in get
    value = self._data[field][record._ids[0]]
KeyError: 139810

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1038, in __get__
    value = env.cache.get(record, self)
  File "/odoo_env/src/openupgrade/odoo/api.py", line 754, in get
    raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: ('ir.attachment(139810,).datas', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/odoo/api.py", line 748, in get
    value = self._data[field][record._ids[0]]
KeyError: 139810

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1038, in __get__
    value = env.cache.get(record, self)
  File "/odoo_env/src/openupgrade/odoo/api.py", line 754, in get
    raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: ('ir.attachment(139810,).store_fname', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1147, in compute_value
    records._compute_field_value(self)
  File "/odoo_env/src/openupgrade/odoo/models.py", line 4021, in _compute_field_value
    getattr(self, field.compute)()
  File "/odoo_env/src/openupgrade/odoo/addons/base/models/ir_attachment.py", line 199, in _compute_datas
    if attach.store_fname:
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1045, in __get__
    recs._fetch_field(self)
  File "/odoo_env/src/openupgrade/odoo/models.py", line 3006, in _fetch_field
    self._read(fnames)
  File "/odoo_env/src/openupgrade/odoo/addons/base/models/ir_attachment.py", line 486, in _read
    return super(IrAttachment, self)._read(fields)
  File "/odoo_env/src/openupgrade/odoo/models.py", line 3099, in _read
    self.env.cache.update(fetched, field, values)
  File "/odoo_env/src/openupgrade/odoo/api.py", line 773, in update
    self._data[field].update(zip(records._ids, values))
MemoryError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/addons/website_sale/migrations/13.0.1.0/post-migration.py", line 32, in convert_image_attachments
    Model.browse(attachment.res_id).image_1920 = attachment.datas
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1062, in __get__
    self.compute_value(recs)
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 2001, in compute_value
    super().compute_value(records)
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1150, in compute_value
    env.add_to_compute(field, records)
  File "/odoo_env/src/openupgrade/odoo/api.py", line 690, in add_to_compute
    self.all.tocompute[field].update(records._ids)
MemoryError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/odoo/api.py", line 748, in get
    value = self._data[field][record._ids[0]]
KeyError: 139810

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1038, in __get__
    value = env.cache.get(record, self)
  File "/odoo_env/src/openupgrade/odoo/api.py", line 754, in get
    raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: ('ir.attachment(139810,).res_id', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo_env/src/openupgrade/odoo/service/server.py", line 1194, in preload_registries
    registry = Registry.new(dbname, update_module=update_module)
  File "/odoo_env/src/openupgrade/odoo/modules/registry.py", line 87, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/odoo_env/src/openupgrade/odoo/modules/loading.py", line 489, in load_modules
    force, status, report, loaded_modules, update_module, models_to_check, upg_registry)
  File "/odoo_env/src/openupgrade/odoo/modules/loading.py", line 368, in load_marked_modules
    upg_registry=upg_registry,
  File "/odoo_env/src/openupgrade/odoo/modules/loading.py", line 256, in load_module_graph
    migrations.migrate_module(package, 'post')
  File "/odoo_env/src/openupgrade/odoo/modules/migration.py", line 191, in migrate_module
    migrate(self.cr, installed_version)
  File "/opt/venv/lib/python3.7/site-packages/openupgradelib/openupgrade.py", line 2285, in wrapped_function
    version,
  File "/odoo_env/src/openupgrade/addons/website_sale/migrations/13.0.1.0/post-migration.py", line 66, in migrate
    convert_image_attachments(env)
  File "/odoo_env/src/openupgrade/addons/website_sale/migrations/13.0.1.0/post-migration.py", line 38, in convert_image_attachments
    attachment.res_id,
  File "/odoo_env/src/openupgrade/odoo/fields.py", line 1045, in __get__
    recs._fetch_field(self)
  File "/odoo_env/src/openupgrade/odoo/models.py", line 3006, in _fetch_field
    self._read(fnames)
  File "/odoo_env/src/openupgrade/odoo/addons/base/models/ir_attachment.py", line 486, in _read
    return super(IrAttachment, self)._read(fields)
  File "/odoo_env/src/openupgrade/odoo/models.py", line 3099, in _read
    self.env.cache.update(fetched, field, values)
  File "/odoo_env/src/openupgrade/odoo/api.py", line 773, in update
    self._data[field].update(zip(records._ids, values))
MemoryError
2025-01-15 17:23:21,090 1 INFO odoo-upgrade odoo.service.server: Initiating shutdown 
2025-01-15 17:23:21,090 1 INFO odoo-upgrade odoo.service.server: Hit CTRL-C again or send a second signal to force the shutdown. 
2025-01-15 17:23:21,090 1 INFO odoo-upgrade odoo.sql_db: ConnectionPool(used=0/count=0/max=64): Closed 1 connections  

i tried using openupgrade.chunked() to iterate over the attachments. it doesn’t prevent the MemoryError errors, but it stops trying later.

huguesdk avatar Jan 20 '25 10:01 huguesdk

I don't think this is a question of the number of images, but a corrupted image that triggers this problem. Please investigate which one is triggering the error.

pedrobaeza avatar Jan 21 '25 08:01 pedrobaeza

@pedrobaeza thank you for your answer. i looked into it, but i could not (yet) find a corrupted image triggering the problem. at each run, the id of the product.image attachement that triggers the first error is different (sometimes higher, sometimes lower), so i still think it is a memory exhaustion problem due to the number of images.

we can see here that the function loops over all the product images and assigns attachment.datas to product.image.image_1920. is this actually loading the data from the files into a bytes string? at which point is this persisted to the filestore and removed from memory? i guess this only happens at the end of the transaction, right? there are tens of gigabytes of (base64-encoded) data handled in this loop, and the computer on which this runs has 32 gib of ram.

how can we force the data to be written to the filestore and removed from memory, or avoid loading so much data in memory? should we create the attachment and copy the file data by hand? i tried iterating over the ids, loading only one record at the time and committing the transaction at each step, but that didn’t change much.

huguesdk avatar Jan 21 '25 13:01 huguesdk

I see... then it's not that. I have migrated DBs with 30k products with images without problems in a 64 GB server, but I haven't dug in the internals on how the memory is managed in these cases. Maybe a savepoint/flush in between may help. chunked is not doing that.

pedrobaeza avatar Jan 21 '25 14:01 pedrobaeza

Has a solution been found for this problem?

I'm having the same problem. When I migrate from v12 to v13, I get a memory error due to the large number of products I have (over 25,000).

I've tried several things, like updating without adding the filestore, which results in a very large log of 404 errors because the files can't be found. Once the migration is complete, I add the filestore in subsequent versions, and it doesn't give any more errors. However, when I get to v18, it doesn't display any images—not for products, contacts, or anything else. They don't appear as broken images, and there's no 404 error in the log either. Although I check, the binary is still correctly present in my updated database, pointing to the folder, but it's not being displayed. I understand that it must make some change to the ir_attachment table during the v13 migration to update the image field or something similar.

But to this day, I'm still struggling with this unsolvable problem.

david19942 avatar Nov 13 '25 15:11 david19942

However, when I get to v18, it doesn't display any images—not for products, contacts, or anything else.

Perhaps it has to do with https://github.com/odoo/odoo/pull/235077

MiquelRForgeFlow avatar Nov 13 '25 15:11 MiquelRForgeFlow

If I understand correctly, that's for transferring images/files from remote to local, but my filestore is local. I've downloaded the entire filestore, and it works correctly in version 12. The problem arises when I migrate to version 13 and it performs the migration over the products, because having so many products causes a memory error. As I said, if I understand correctly, my filestore is local and always remains local, since I manually transfer it from version to version as I update.

david19942 avatar Nov 13 '25 16:11 david19942

If I understand correctly, that's for transferring images/files from remote to local, but my filestore is local.

Right. Let's understand the issue through the logs:

File "/odoo_env/src/openupgrade/addons/website_sale/migrations/13.0.1.0/post-migration.py", line 32, in convert_image_attachments
    Model.browse(attachment.res_id).image_1920 = attachment.datas

It's called here: https://github.com/OCA/OpenUpgrade/blob/13.0/addons/website_sale/migrations/13.0.1.0/post-migration.py#L32 But datas is a computed field.

File "/odoo_env/src/openupgrade/odoo/addons/base/models/ir_attachment.py", line 199, in _compute_datas
    if attach.store_fname:

Which is called in https://github.com/OCA/OpenUpgrade/blob/13.0/odoo/addons/base/models/ir_attachment.py#L199.

So it uses store_fname. The field store_fname stores the attachment content, but it's usually a lot of bytes. But the cache will have to load so much data: the store_fname for all the attachments from the search in convert_image_attachments. It's like putting a big chunk of the filestore in the cache, which it would break some memory limit.

Thus, try migrating to v13 increasing the memory limit (https://github.com/OCA/OpenUpgrade/blob/13.0/odoo/tools/config.py#L307).

MiquelRForgeFlow avatar Nov 13 '25 16:11 MiquelRForgeFlow

I increased the memory size to 32GB, but after 11 minutes it always ends up failing and giving a memory error.

Look my error:

2025-11-13 16:56:18,051 13 INFO odoo_ddbb odoo.modules.registry: module product: creating or updating database tables 
2025-11-13 16:56:19,245 13 INFO odoo_ddbb odoo.schema: Keep unexpected index res_partner_city_id_index on table res_partner 
2025-11-13 16:56:19,436 13 INFO odoo_ddbb odoo.models: Storing computed values of product.template.can_image_1024_be_zoomed 
2025-11-13 16:56:19,437 13 INFO odoo_ddbb odoo.models: Storing computed values of product.template.has_configurable_attributes 
2025-11-13 16:56:19,509 13 INFO odoo_ddbb odoo.models: Storing computed values of product.product.can_image_variant_1024_be_zoomed 
2025-11-13 16:56:19,556 13 INFO odoo_ddbb odoo.models: Storing computed values of product.attribute.product_tmpl_ids 
2025-11-13 16:56:29,233 13 INFO odoo_ddbb odoo.modules.loading: loading product/data/product_data.xml 
2025-11-13 16:56:29,246 13 INFO odoo_ddbb odoo.modules.loading: loading product/security/product_security.xml 
2025-11-13 16:56:29,685 13 INFO odoo_ddbb odoo.modules.loading: loading product/security/ir.model.access.csv 
2025-11-13 16:56:29,789 13 INFO odoo_ddbb odoo.modules.loading: loading product/wizard/product_price_list_views.xml 
2025-11-13 16:56:29,804 13 INFO odoo_ddbb odoo.modules.loading: loading product/views/res_config_settings_views.xml 
2025-11-13 16:56:29,874 13 INFO odoo_ddbb odoo.modules.loading: loading product/views/product_attribute_views.xml 
2025-11-13 16:56:29,966 13 INFO odoo_ddbb odoo.models.unlink: User #1 deleted ir.actions.act_window.view records with IDs: [81, 82] 
2025-11-13 16:56:29,971 13 INFO odoo_ddbb odoo.modules.loading: loading product/views/product_views.xml 
2025-11-13 16:56:30,082 13 INFO odoo_ddbb odoo.models.unlink: User #1 deleted ir.actions.act_window.view records with IDs: [83, 84, 85] 
2025-11-13 16:56:30,281 13 INFO odoo_ddbb odoo.models.unlink: User #1 deleted ir.actions.act_window.view records with IDs: [86, 87] 
2025-11-13 16:56:30,338 13 INFO odoo_ddbb odoo.modules.loading: loading product/views/product_template_views.xml 
2025-11-13 16:56:30,428 13 INFO odoo_ddbb odoo.modules.loading: loading product/views/product_pricelist_views.xml 
2025-11-13 16:56:30,631 13 INFO odoo_ddbb odoo.modules.loading: loading product/views/res_partner_views.xml 
2025-11-13 16:56:30,693 13 INFO odoo_ddbb odoo.modules.loading: loading product/report/product_reports.xml 
2025-11-13 16:56:30,715 13 INFO odoo_ddbb odoo.modules.loading: loading product/report/product_pricelist_templates.xml 
2025-11-13 16:56:30,728 13 INFO odoo_ddbb odoo.modules.loading: loading product/report/product_product_templates.xml 
2025-11-13 16:56:30,759 13 INFO odoo_ddbb odoo.modules.loading: loading product/report/product_template_templates.xml 
2025-11-13 16:56:30,778 13 INFO odoo_ddbb odoo.modules.loading: loading product/report/product_packaging.xml 
2025-11-13 16:56:30,798 13 INFO odoo_ddbb odoo.modules.migration: module product: Running migration [13.0.1.2>] post-migration 
2025-11-13 16:56:30,800 13 INFO odoo_ddbb OpenUpgrade: product: post-migration script called with version 12.0.1.2 
2025-11-13 16:56:30,800 13 INFO odoo_ddbb OpenUpgrade: product: loading migrations/13.0.1.2/noupdate_changes.xml 
2025-11-13 16:58:46,757 13 INFO odoo_ddbb OpenUpgrade: Executing method empty_template_pricelist_company 
2025-11-13 16:58:48,751 13 DEBUG odoo_ddbb OpenUpgrade: 25775 rows affected after 0:00:01.993095 running UPDATE product_template SET company_id = NULL WHERE company_id is NOT NULL 
2025-11-13 16:58:48,751 13 DEBUG odoo_ddbb OpenUpgrade: 0 rows affected after 0:00:00.000211 running UPDATE product_pricelist SET company_id = NULL WHERE company_id is NOT NULL 
2025-11-13 17:09:22,487 13 ERROR odoo_ddbb odoo.modules.loading: Error executing post migration script for module product
`-> stock
:  
2025-11-13 17:09:22,491 13 ERROR odoo_ddbb odoo.modules.registry: Failed to load registry 
Traceback (most recent call last):
  File "/opt/openupgrade/odoo/modules/registry.py", line 87, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/opt/openupgrade/odoo/modules/loading.py", line 487, in load_modules
    processed_modules += load_marked_modules(cr, graph,
  File "/opt/openupgrade/odoo/modules/loading.py", line 365, in load_marked_modules
    loaded, processed = load_module_graph(
  File "/opt/openupgrade/odoo/modules/loading.py", line 256, in load_module_graph
    migrations.migrate_module(package, 'post')
  File "/opt/openupgrade/odoo/modules/migration.py", line 191, in migrate_module
    migrate(self.cr, installed_version)
  File "/usr/local/lib/python3.8/site-packages/openupgradelib/openupgrade.py", line 2421, in wrapped_function
    raise
  File "/usr/local/lib/python3.8/contextlib.py", line 525, in __exit__
    raise exc_details[1]
  File "/usr/local/lib/python3.8/contextlib.py", line 510, in __exit__
    if cb(*exc_details):
  File "/usr/local/lib/python3.8/contextlib.py", line 120, in __exit__
    next(self.gen)
  File "/usr/local/lib/python3.8/site-packages/openupgradelib/openupgrade.py", line 2739, in savepoint
    yield
  File "/usr/local/lib/python3.8/contextlib.py", line 120, in __exit__
    next(self.gen)
  File "/opt/openupgrade/odoo/sql_db.py", line 449, in savepoint
    flush_env(self, clear=False)
  File "/opt/openupgrade/odoo/sql_db.py", line 76, in flush_env
    env_to_flush['base'].flush()
  File "/opt/openupgrade/odoo/models.py", line 5537, in flush
    self.recompute()
  File "/opt/openupgrade/odoo/models.py", line 5979, in recompute
    process(field)
  File "/opt/openupgrade/odoo/models.py", line 5963, in process
    recs.mapped(field.name)
  File "/opt/openupgrade/odoo/models.py", line 5345, in mapped
    recs = recs._mapped_func(operator.itemgetter(name))
  File "/opt/openupgrade/odoo/models.py", line 5304, in _mapped_func
    vals = [func(rec) for rec in self]
  File "/opt/openupgrade/odoo/models.py", line 5304, in <listcomp>
    vals = [func(rec) for rec in self]
  File "/opt/openupgrade/odoo/models.py", line 5769, in __getitem__
    return self._fields[key].__get__(self, type(self))
  File "/opt/openupgrade/odoo/fields.py", line 1033, in __get__
    self.compute_value(recs)
  File "/opt/openupgrade/odoo/fields.py", line 2001, in compute_value
    super().compute_value(records)
  File "/opt/openupgrade/odoo/fields.py", line 1147, in compute_value
    records._compute_field_value(self)
  File "/opt/openupgrade/odoo/models.py", line 4023, in _compute_field_value
    field.compute(self)
  File "/opt/openupgrade/odoo/fields.py", line 581, in _compute_related
    record[self.name] = self._process_related(value[self.related_field.name])
  File "/opt/openupgrade/odoo/models.py", line 5778, in __setitem__
    return self._fields[key].__set__(self, value)
  File "/opt/openupgrade/odoo/fields.py", line 1108, in __set__
    self.write(protected_records, value)
  File "/opt/openupgrade/odoo/fields.py", line 2138, in write
    super(Image, self).write(records, new_value)
  File "/opt/openupgrade/odoo/fields.py", line 2075, in write
    atts.create([{
  File "<decorator-gen-40>", line 2, in create
  File "/opt/openupgrade/odoo/api.py", line 339, in _model_create_multi
    return create(self, arg)
  File "/opt/openupgrade/odoo/addons/base/models/ir_attachment.py", line 534, in create
    values.update(self._get_datas_related_values(values.pop('datas'), values['mimetype']))
  File "/opt/openupgrade/odoo/addons/base/models/ir_attachment.py", line 225, in _get_datas_related_values
    values['store_fname'] = self._file_write(data, values['checksum'])
  File "/opt/openupgrade/odoo/addons/base/models/ir_attachment.py", line 111, in _file_write
    bin_value = base64.b64decode(value)
  File "/usr/local/lib/python3.8/base64.py", line 87, in b64decode
    return binascii.a2b_base64(s)
MemoryError
2025-11-13 17:09:22,495 13 CRITICAL odoo_ddbb odoo.service.server: Failed to initialize database `odoo_ddbb`. 
Traceback (most recent call last):
  File "/opt/openupgrade/odoo/service/server.py", line 1194, in preload_registries
    registry = Registry.new(dbname, update_module=update_module)
  File "/opt/openupgrade/odoo/modules/registry.py", line 87, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/opt/openupgrade/odoo/modules/loading.py", line 487, in load_modules
    processed_modules += load_marked_modules(cr, graph,
  File "/opt/openupgrade/odoo/modules/loading.py", line 365, in load_marked_modules
    loaded, processed = load_module_graph(
  File "/opt/openupgrade/odoo/modules/loading.py", line 256, in load_module_graph
    migrations.migrate_module(package, 'post')
  File "/opt/openupgrade/odoo/modules/migration.py", line 191, in migrate_module
    migrate(self.cr, installed_version)
  File "/usr/local/lib/python3.8/site-packages/openupgradelib/openupgrade.py", line 2421, in wrapped_function
    raise
  File "/usr/local/lib/python3.8/contextlib.py", line 525, in __exit__
    raise exc_details[1]
  File "/usr/local/lib/python3.8/contextlib.py", line 510, in __exit__
    if cb(*exc_details):
  File "/usr/local/lib/python3.8/contextlib.py", line 120, in __exit__
    next(self.gen)
  File "/usr/local/lib/python3.8/site-packages/openupgradelib/openupgrade.py", line 2739, in savepoint
    yield
  File "/usr/local/lib/python3.8/contextlib.py", line 120, in __exit__
    next(self.gen)
  File "/opt/openupgrade/odoo/sql_db.py", line 449, in savepoint
    flush_env(self, clear=False)
  File "/opt/openupgrade/odoo/sql_db.py", line 76, in flush_env
    env_to_flush['base'].flush()
  File "/opt/openupgrade/odoo/models.py", line 5537, in flush
    self.recompute()
  File "/opt/openupgrade/odoo/models.py", line 5979, in recompute
    process(field)
  File "/opt/openupgrade/odoo/models.py", line 5963, in process
    recs.mapped(field.name)
  File "/opt/openupgrade/odoo/models.py", line 5345, in mapped
    recs = recs._mapped_func(operator.itemgetter(name))
  File "/opt/openupgrade/odoo/models.py", line 5304, in _mapped_func
    vals = [func(rec) for rec in self]
  File "/opt/openupgrade/odoo/models.py", line 5304, in <listcomp>
    vals = [func(rec) for rec in self]
  File "/opt/openupgrade/odoo/models.py", line 5769, in __getitem__
    return self._fields[key].__get__(self, type(self))
  File "/opt/openupgrade/odoo/fields.py", line 1033, in __get__
    self.compute_value(recs)
  File "/opt/openupgrade/odoo/fields.py", line 2001, in compute_value
    super().compute_value(records)
  File "/opt/openupgrade/odoo/fields.py", line 1147, in compute_value
    records._compute_field_value(self)
  File "/opt/openupgrade/odoo/models.py", line 4023, in _compute_field_value
    field.compute(self)
  File "/opt/openupgrade/odoo/fields.py", line 581, in _compute_related
    record[self.name] = self._process_related(value[self.related_field.name])
  File "/opt/openupgrade/odoo/models.py", line 5778, in __setitem__
    return self._fields[key].__set__(self, value)
  File "/opt/openupgrade/odoo/fields.py", line 1108, in __set__
    self.write(protected_records, value)
  File "/opt/openupgrade/odoo/fields.py", line 2138, in write
    super(Image, self).write(records, new_value)
  File "/opt/openupgrade/odoo/fields.py", line 2075, in write
    atts.create([{
  File "<decorator-gen-40>", line 2, in create
  File "/opt/openupgrade/odoo/api.py", line 339, in _model_create_multi
    return create(self, arg)
  File "/opt/openupgrade/odoo/addons/base/models/ir_attachment.py", line 534, in create
    values.update(self._get_datas_related_values(values.pop('datas'), values['mimetype']))
  File "/opt/openupgrade/odoo/addons/base/models/ir_attachment.py", line 225, in _get_datas_related_values
    values['store_fname'] = self._file_write(data, values['checksum'])
  File "/opt/openupgrade/odoo/addons/base/models/ir_attachment.py", line 111, in _file_write
    bin_value = base64.b64decode(value)
  File "/usr/local/lib/python3.8/base64.py", line 87, in b64decode
    return binascii.a2b_base64(s)
MemoryError
2025-11-13 17:09:22,495 13 INFO odoo_ddbb odoo.service.server: Initiating shutdown 
2025-11-13 17:09:22,495 13 INFO odoo_ddbb odoo.service.server: Hit CTRL-C again or send a second signal to force the shutdown. 
2025-11-13 17:09:22,495 13 INFO odoo_ddbb odoo.sql_db: ConnectionPool(used=0/count=0/max=64): Closed 1 connections 

david19942 avatar Nov 13 '25 17:11 david19942

It seems this error in product module post-migration is not the same that the initial one.

  File "/opt/openupgrade/odoo/addons/base/models/ir_attachment.py", line 534, in create
    values.update(self._get_datas_related_values(values.pop('datas'), values['mimetype']))
  File "/opt/openupgrade/odoo/addons/base/models/ir_attachment.py", line 225, in _get_datas_related_values
    values['store_fname'] = self._file_write(data, values['checksum'])
  File "/opt/openupgrade/odoo/addons/base/models/ir_attachment.py", line 111, in _file_write
    bin_value = base64.b64decode(value)

I don't know why it tries to create an attachment at that point of the migration. But it's clear that the attachment creation fails because the value is wrong (and cannot decode).

MiquelRForgeFlow avatar Nov 13 '25 17:11 MiquelRForgeFlow

Is it possible that the image or attachment is broken or incorrectly encoded? I ask because I need to search for the corrupted file in this case, as I have to look through all the products, contacts, and PDFs to find the culprit since it's not showing me any ID.

david19942 avatar Nov 14 '25 08:11 david19942

here is how we fixed the problem on our side. what do you think?

huguesdk avatar Nov 14 '25 10:11 huguesdk

@huguesdk that's nice!

MiquelRForgeFlow avatar Nov 14 '25 10:11 MiquelRForgeFlow

I tried several things:

  1. Deleting images larger than 1 MB.
  2. Running the update, and now I'm getting a different error.
  3. Running a quick script to scan for corrupted files, and it didn't find any.

New error:

2025-11-14 10:21:25,081 13 INFO odoo_ddbb odoo.modules.loading: loading product/views/product_template_views.xml 
2025-11-14 10:21:25,161 13 INFO odoo_ddbb odoo.modules.loading: loading product/views/product_pricelist_views.xml 
2025-11-14 10:21:25,355 13 INFO odoo_ddbb odoo.modules.loading: loading product/views/res_partner_views.xml 
2025-11-14 10:21:25,405 13 INFO odoo_ddbb odoo.modules.loading: loading product/report/product_reports.xml 
2025-11-14 10:21:25,427 13 INFO odoo_ddbb odoo.modules.loading: loading product/report/product_pricelist_templates.xml 
2025-11-14 10:21:25,440 13 INFO odoo_ddbb odoo.modules.loading: loading product/report/product_product_templates.xml 
2025-11-14 10:21:25,470 13 INFO odoo_ddbb odoo.modules.loading: loading product/report/product_template_templates.xml 
2025-11-14 10:21:25,489 13 INFO odoo_ddbb odoo.modules.loading: loading product/report/product_packaging.xml 
2025-11-14 10:21:25,503 13 INFO odoo_ddbb odoo.modules.migration: module product: Running migration [13.0.1.2>] post-migration 
2025-11-14 10:21:25,504 13 INFO odoo_ddbb OpenUpgrade: product: post-migration script called with version 12.0.1.2 
2025-11-14 10:21:25,504 13 INFO odoo_ddbb OpenUpgrade: product: loading migrations/13.0.1.2/noupdate_changes.xml 
2025-11-14 10:23:36,332 13 INFO odoo_ddbb OpenUpgrade: Executing method empty_template_pricelist_company 
2025-11-14 10:23:38,430 13 DEBUG odoo_ddbb OpenUpgrade: 25775 rows affected after 0:00:02.097188 running UPDATE product_template SET company_id = NULL WHERE company_id is NOT NULL 
2025-11-14 10:23:38,430 13 DEBUG odoo_ddbb OpenUpgrade: 0 rows affected after 0:00:00.000252 running UPDATE product_pricelist SET company_id = NULL WHERE company_id is NOT NULL 
Insufficient memory (case 4)
2025-11-14 10:38:56,051 13 ERROR odoo_ddbb odoo.modules.loading: Error executing post migration script for module product
`-> stock
: broken data stream when writing image file 
2025-11-14 10:38:56,058 13 ERROR odoo_ddbb odoo.modules.registry: Failed to load registry 
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/PIL/ImageFile.py", line 547, in _save
    fh = fp.fileno()
io.UnsupportedOperation: fileno

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/openupgrade/odoo/modules/registry.py", line 87, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/opt/openupgrade/odoo/modules/loading.py", line 487, in load_modules
    processed_modules += load_marked_modules(cr, graph,
  File "/opt/openupgrade/odoo/modules/loading.py", line 365, in load_marked_modules
    loaded, processed = load_module_graph(
  File "/opt/openupgrade/odoo/modules/loading.py", line 256, in load_module_graph
    migrations.migrate_module(package, 'post')
  File "/opt/openupgrade/odoo/modules/migration.py", line 191, in migrate_module
    migrate(self.cr, installed_version)
  File "/usr/local/lib/python3.8/site-packages/openupgradelib/openupgrade.py", line 2421, in wrapped_function
    raise
  File "/usr/local/lib/python3.8/contextlib.py", line 525, in __exit__
    raise exc_details[1]
  File "/usr/local/lib/python3.8/contextlib.py", line 510, in __exit__
    if cb(*exc_details):
  File "/usr/local/lib/python3.8/contextlib.py", line 120, in __exit__
    next(self.gen)
  File "/usr/local/lib/python3.8/site-packages/openupgradelib/openupgrade.py", line 2739, in savepoint
    yield
  File "/usr/local/lib/python3.8/contextlib.py", line 120, in __exit__
    next(self.gen)
  File "/opt/openupgrade/odoo/sql_db.py", line 449, in savepoint
    flush_env(self, clear=False)
  File "/opt/openupgrade/odoo/sql_db.py", line 76, in flush_env
    env_to_flush['base'].flush()
  File "/opt/openupgrade/odoo/models.py", line 5537, in flush
    self.recompute()
  File "/opt/openupgrade/odoo/models.py", line 5979, in recompute
    process(field)
  File "/opt/openupgrade/odoo/models.py", line 5963, in process
    recs.mapped(field.name)
  File "/opt/openupgrade/odoo/models.py", line 5345, in mapped
    recs = recs._mapped_func(operator.itemgetter(name))
  File "/opt/openupgrade/odoo/models.py", line 5304, in _mapped_func
    vals = [func(rec) for rec in self]
  File "/opt/openupgrade/odoo/models.py", line 5304, in <listcomp>
    vals = [func(rec) for rec in self]
  File "/opt/openupgrade/odoo/models.py", line 5769, in __getitem__
    return self._fields[key].__get__(self, type(self))
  File "/opt/openupgrade/odoo/fields.py", line 1033, in __get__
    self.compute_value(recs)
  File "/opt/openupgrade/odoo/fields.py", line 2001, in compute_value
    super().compute_value(records)
  File "/opt/openupgrade/odoo/fields.py", line 1147, in compute_value
    records._compute_field_value(self)
  File "/opt/openupgrade/odoo/models.py", line 4023, in _compute_field_value
    field.compute(self)
  File "/opt/openupgrade/odoo/fields.py", line 581, in _compute_related
    record[self.name] = self._process_related(value[self.related_field.name])
  File "/opt/openupgrade/odoo/fields.py", line 2151, in _process_related
    return self._image_process(super()._process_related(value))
  File "/opt/openupgrade/odoo/fields.py", line 2143, in _image_process
    return image_process(value,
  File "/opt/openupgrade/odoo/tools/image.py", line 288, in image_process
    return image.image_base64(quality=quality, output_format=output_format)
  File "/opt/openupgrade/odoo/tools/image.py", line 150, in image_base64
    return image_to_base64(output_image, **opt)
  File "/opt/openupgrade/odoo/tools/image.py", line 422, in image_to_base64
    image.save(stream, format=format, **params)
  File "/usr/local/lib/python3.8/site-packages/PIL/Image.py", line 2568, in save
    save_handler(self, fp, filename)
  File "/usr/local/lib/python3.8/site-packages/PIL/JpegImagePlugin.py", line 813, in _save
    ImageFile._save(im, fp, [("jpeg", (0, 0) + im.size, 0, rawmode)], bufsize)
  File "/usr/local/lib/python3.8/site-packages/PIL/ImageFile.py", line 551, in _save
    _encode_tile(im, fp, tile, bufsize, None, exc)
  File "/usr/local/lib/python3.8/site-packages/PIL/ImageFile.py", line 578, in _encode_tile
    raise _get_oserror(errcode, encoder=True) from exc
OSError: broken data stream when writing image file
2025-11-14 10:38:56,072 13 CRITICAL odoo_ddbb odoo.service.server: Failed to initialize database `odoo_ddbb`. 
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/PIL/ImageFile.py", line 547, in _save
    fh = fp.fileno()
io.UnsupportedOperation: fileno

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/openupgrade/odoo/service/server.py", line 1194, in preload_registries
    registry = Registry.new(dbname, update_module=update_module)
  File "/opt/openupgrade/odoo/modules/registry.py", line 87, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/opt/openupgrade/odoo/modules/loading.py", line 487, in load_modules
    processed_modules += load_marked_modules(cr, graph,
  File "/opt/openupgrade/odoo/modules/loading.py", line 365, in load_marked_modules
    loaded, processed = load_module_graph(
  File "/opt/openupgrade/odoo/modules/loading.py", line 256, in load_module_graph
    migrations.migrate_module(package, 'post')
  File "/opt/openupgrade/odoo/modules/migration.py", line 191, in migrate_module
    migrate(self.cr, installed_version)
  File "/usr/local/lib/python3.8/site-packages/openupgradelib/openupgrade.py", line 2421, in wrapped_function
    raise
  File "/usr/local/lib/python3.8/contextlib.py", line 525, in __exit__
    raise exc_details[1]
  File "/usr/local/lib/python3.8/contextlib.py", line 510, in __exit__
    if cb(*exc_details):
  File "/usr/local/lib/python3.8/contextlib.py", line 120, in __exit__
    next(self.gen)
  File "/usr/local/lib/python3.8/site-packages/openupgradelib/openupgrade.py", line 2739, in savepoint
    yield
  File "/usr/local/lib/python3.8/contextlib.py", line 120, in __exit__
    next(self.gen)
  File "/opt/openupgrade/odoo/sql_db.py", line 449, in savepoint
    flush_env(self, clear=False)
  File "/opt/openupgrade/odoo/sql_db.py", line 76, in flush_env
    env_to_flush['base'].flush()
  File "/opt/openupgrade/odoo/models.py", line 5537, in flush
    self.recompute()
  File "/opt/openupgrade/odoo/models.py", line 5979, in recompute
    process(field)
  File "/opt/openupgrade/odoo/models.py", line 5963, in process
    recs.mapped(field.name)
  File "/opt/openupgrade/odoo/models.py", line 5345, in mapped
    recs = recs._mapped_func(operator.itemgetter(name))
  File "/opt/openupgrade/odoo/models.py", line 5304, in _mapped_func
    vals = [func(rec) for rec in self]
  File "/opt/openupgrade/odoo/models.py", line 5304, in <listcomp>
    vals = [func(rec) for rec in self]
  File "/opt/openupgrade/odoo/models.py", line 5769, in __getitem__
    return self._fields[key].__get__(self, type(self))
  File "/opt/openupgrade/odoo/fields.py", line 1033, in __get__
    self.compute_value(recs)
  File "/opt/openupgrade/odoo/fields.py", line 2001, in compute_value
    super().compute_value(records)
  File "/opt/openupgrade/odoo/fields.py", line 1147, in compute_value
    records._compute_field_value(self)
  File "/opt/openupgrade/odoo/models.py", line 4023, in _compute_field_value
    field.compute(self)
  File "/opt/openupgrade/odoo/fields.py", line 581, in _compute_related
    record[self.name] = self._process_related(value[self.related_field.name])
  File "/opt/openupgrade/odoo/fields.py", line 2151, in _process_related
    return self._image_process(super()._process_related(value))
  File "/opt/openupgrade/odoo/fields.py", line 2143, in _image_process
    return image_process(value,
  File "/opt/openupgrade/odoo/tools/image.py", line 288, in image_process
    return image.image_base64(quality=quality, output_format=output_format)
  File "/opt/openupgrade/odoo/tools/image.py", line 150, in image_base64
    return image_to_base64(output_image, **opt)
  File "/opt/openupgrade/odoo/tools/image.py", line 422, in image_to_base64
    image.save(stream, format=format, **params)
  File "/usr/local/lib/python3.8/site-packages/PIL/Image.py", line 2568, in save
    save_handler(self, fp, filename)
  File "/usr/local/lib/python3.8/site-packages/PIL/JpegImagePlugin.py", line 813, in _save
    ImageFile._save(im, fp, [("jpeg", (0, 0) + im.size, 0, rawmode)], bufsize)
  File "/usr/local/lib/python3.8/site-packages/PIL/ImageFile.py", line 551, in _save
    _encode_tile(im, fp, tile, bufsize, None, exc)
  File "/usr/local/lib/python3.8/site-packages/PIL/ImageFile.py", line 578, in _encode_tile
    raise _get_oserror(errcode, encoder=True) from exc
OSError: broken data stream when writing image file
2025-11-14 10:38:56,073 13 INFO odoo_ddbb odoo.service.server: Initiating shutdown 
2025-11-14 10:38:56,073 13 INFO odoo_ddbb odoo.service.server: Hit CTRL-C again or send a second signal to force the shutdown. 
2025-11-14 10:38:56,073 13 INFO odoo_ddbb odoo.sql_db: ConnectionPool(used=0/count=0/max=64): Closed 1 connections  

Migration is usually stopped after 12 minutes. I'm not sure if the problem can be continued in this thread, as I thought it was something related.

david19942 avatar Nov 14 '25 11:11 david19942

is there enough free disk space for the filestore?

huguesdk avatar Nov 14 '25 12:11 huguesdk

Yes, there is 80GB of free space.

david19942 avatar Nov 14 '25 12:11 david19942

have you tried applying the changes like here but in this script? it’s almost the same function.

huguesdk avatar Nov 14 '25 12:11 huguesdk