From ffd27739a471fd188aff9ae8ac5b67052aebca36 Mon Sep 17 00:00:00 2001 From: Christophe Monniez Date: Thu, 21 Feb 2019 14:46:02 +0100 Subject: [PATCH] [FIX] runbot: limit number of log lines shown on build page When displaying build logs, all the messages from ir_logging about this particular build are fetched from the database. From time to times, it happens that the number of logged messages is really huge. Those messages lines could also contain multiple lines, multiplying the number of row to generate in the html page. When this happens, the process that generates the template last a long time and ends with a MemoryError. If the end user, bored, hits the refresh button multiple times, all the workers will be busy building this template. In the end, all users get a Bad Gateway from nginx. With this commit, the number of messages that will be taken into account will be limited to 10000. --- runbot/controllers/frontend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runbot/controllers/frontend.py b/runbot/controllers/frontend.py index 27110891..c24a4256 100644 --- a/runbot/controllers/frontend.py +++ b/runbot/controllers/frontend.py @@ -190,7 +190,7 @@ class Runbot(Controller): domain.append(('level', '=', level.upper())) if search: domain.append(('message', 'ilike', search)) - logging_ids = Logging.sudo().search(domain) + logging_ids = Logging.sudo().search(domain, limit=10000) context = { 'repo': build.repo_id,