Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all Industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services for Partners
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

Cannot allocate memory for output buffer error V12

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
reporttracebackmemoryv12
4891 Vues
Avatar
Brent Vanleerberghe

Hi

So I was developing a module that exports every products barcode and image to an Excel, and that then returns the an Excel file. This works fine when there's just a couple pictures, but when I tried running the method on a bigger db with tons more pictures I got an error.

Here is the code that's being run:

class ExportProductImage(models.TransientModel):
_name = "export.product.image"
_description = "Export product image"
datas = fields.Binary('File', readonly=True)
datas_fname = fields.Char('Filename', readonly=True)
def generate_excel_product_image(self):
filename = 'product_images'
fp = BytesIO()
book = xlsxwriter.Workbook(fp)
sheet1 = book.add_worksheet("Afbeeldingen")
sheet1.set_landscape()
sheet1.set_default_row(230)
sheet1.set_column('B:B', 73)
sheet1.set_row(0, 20)
sheet1.write('A1', 'Barcode')
sheet1.write('B1', 'Afbeelding')
product_templates = self.env['product.template'].search([]) # image_1920
row = 2
for temp in product_templates:
if temp.image_1024:
sheet1.write('A'+str(row), "'" + str(temp.barcode))
image = BytesIO(base64.b64decode(temp.image_1024))
sheet1.insert_image('B' + str(row), "img" + str(row), {'x_scale': 0.5, 'y_scale': 0.5, 'image_data': image, 'object_position': 1})
row += 1
book.close()
out = base64.encodestring(fp.getvalue())
self.write({'datas': out, 'datas_fname': filename})
fp.close()
filename += '%2Exlsx'
return {
'type': 'ir.actions.act_url',
'target': 'new',
'url': 'web/content/?model=' + self._name + '&id=' + str(
self.id) + '&field=datas&download=true&filename=' + filename,
}



Here is the traceback:

Fout:
Odoo Server Error

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 225, in execute
    res = self._obj.execute(query, params)
psycopg2.OperationalError: cannot allocate memory for output buffer


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/loglevels.py", line 92, in ustr
    return text_type(value)
MemoryError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 656, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 314, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 87, in reraise
    raise value
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 698, in dispatch
    result = self._call_function(**self.params)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 346, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 97, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 339, in checked_call
    result = self.endpoint(*a, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 941, in __call__
    return self.method(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 519, in response_wrap
    response = f(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 966, in call_button
    action = self._call_kw(model, method, args, {})
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 954, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 759, in call_kw
    return _call_kw_multi(method, model, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 746, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/mnt/repo/custom/report_stock_wizard/wizard/export_image.py", line 42, in generate_excel_product_image
    self.write({'datas': out, 'datas_fname': filename})
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 3324, in write
    self._write(store_vals)
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 3417, in _write
    cr.execute(query, params + [sub_ids])
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 148, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 228, in execute
    _logger.error("bad query: %s\nERROR: %s", ustr(self._obj.query or query), e)
  File "/usr/lib/python3/dist-packages/odoo/loglevels.py", line 94, in ustr
    raise UnicodeError('unable to convert %r' % (value,))
MemoryError


Anyone know how I could solve this?

For those wondering, these are in my config file:

limit_memory_hard = 2684354560
limit_memory_soft = 2147483648
limit_request = 8192
limit_time_cpu = 120
limit_time_real = 9999
limit_time_real_cron = -1
longpolling_port = 8072
max_cron_threads = 9
workers = 0


When I put more then 0 workers, I get a bus error so that's another problem.




0
Avatar
Ignorer
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
v13: Error: most likely hit a memory limit
report memory Odoo13.0
Avatar
Avatar
1
déc. 23
5318
Pdf Report header margin-top Résolu
pdf report v12
Avatar
Avatar
1
août 23
5920
Add Owner to P&L
accounting report #odoo v12
Avatar
Avatar
1
janv. 20
3759
Hi, I don't know to How to save a qweb report to a binary field Résolu
report odoo v12 v13 v14
Avatar
Avatar
1
avr. 22
3803
Report page / header height Résolu
qweb report sale.order qweb-report v12
Avatar
Avatar
2
sept. 20
7005
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now