Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
Sending emails from Openerp 7 causes 1GB memory spike. This is caused by this part of the code:
fol_obj = self.pool.get("mail.followers")
fol_ids = fol_obj.search(cr, SUPERUSER_ID, [
('res_model', '=', message.model),
('res_id', '=', message.res_id),
('subtype_ids', 'in', message.subtype_id.id)
in /openerp-base/src/addons/mail/mail_message.py (def _notify method line 881).
Our mail_folowers table contains around 3 000 000 rows. The search method, in converting our code example to sql statement, at the point where it creates a where clause, it does a string supstitution something like - "where s%, s%, s%...." with 3 000 000 %s characters, and then substitutes a list of 3 million id elements to create a single string. Than it executes that string. This causes a memory error on our system in /openerp-base/src/server/openerp/tools/misc.py, flatten() method (line 226).
A workaround is to use cr.execute() insted of search method, but I am afraid that this points to a bigger problem. When using tables with more than a couple of million of rows, search is a big problem.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 7/30/15, 8:53 AM|
|Seen: 472 times|
|Last updated: 7/30/15, 9:35 AM|