odoo / docker

Other
978 stars 1.56k forks source link

Odoo thread times out when making pdf #423

Open iangozer opened 2 years ago

iangozer commented 2 years ago

I am having an issue with Odoo 15 (although tested and is happening in 14 too) where any time Odoo is asked to do a task that requires making a pdf (send an email quote, download an email quote) I just get a spinning wheel and eventually it times out.

I can't see anything in the useful in logs apart from the timeout, the timeout log doesn't show any errors just point to a whole bunch of different lines in different files.

CPU and memory are fine.

This is in a Linode instance, behind a Traefik reverse proxy it lets encrypt, but I can't imagine that would affect the pdf.

 WARNING ? odoo.service.server: Thread <Thread(odoo.service.http.request.140101450159872, started 140101450159872)> virtual real time limit (159/120s) reached.
2022-10-08 09:46:22,087 1 INFO ? odoo.service.server: Dumping stacktrace of limit exceeding threads before reloading
2022-10-08 09:46:22,097 1 INFO ? odoo.tools.misc:
# Thread: <Thread(odoo.service.http.request.140101450159872, started 140101450159872)> (db:mydb) (uid:2) (url:http://mydomain.com/web/dataset/call_kw/mail.compose.message/onchange)
File: "/usr/lib/python3.9/threading.py", line 912, in _bootstrap
  self._bootstrap_inner()
File: "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
  self.run()
File: "/usr/lib/python3.9/threading.py", line 892, in run
  self._target(*self._args, **self._kwargs)
File: "/usr/lib/python3.9/socketserver.py", line 650, in process_request_thread
  self.finish_request(request, client_address)
File: "/usr/lib/python3.9/socketserver.py", line 360, in finish_request
  self.RequestHandlerClass(request, client_address, self)
File: "/usr/lib/python3.9/socketserver.py", line 720, in __init__
  self.handle()
File: "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 345, in handle
  BaseHTTPRequestHandler.handle(self)
File: "/usr/lib/python3.9/http/server.py", line 427, in handle
  self.handle_one_request()
File: "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 379, in handle_one_request
  return self.run_wsgi()
File: "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 323, in run_wsgi
  execute(self.server.app)
File: "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 312, in execute
  application_iter = app(environ, start_response)
File: "/usr/lib/python3/dist-packages/odoo/service/server.py", line 482, in app
  return self.app(e, s)
File: "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 112, in application
  return application_unproxied(environ, start_response)
File: "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 87, in application_unproxied
  result = odoo.http.root(environ, start_response)
File: "/usr/lib/python3/dist-packages/odoo/http.py", line 1336, in __call__
  return self.dispatch(environ, start_response)
File: "/usr/lib/python3/dist-packages/odoo/http.py", line 1302, in __call__
  return self.app(environ, start_wrapped)
File: "/usr/lib/python3/dist-packages/werkzeug/middleware/shared_data.py", line 260, in __call__
  return self.app(environ, start_response)
File: "/usr/lib/python3/dist-packages/odoo/http.py", line 1531, in dispatch
  result = ir_http._dispatch()
File: "/usr/lib/python3/dist-packages/odoo/addons/website_sale/models/ir_http.py", line 15, in _dispatch
  return super(IrHttp, cls)._dispatch()
File: "/usr/lib/python3/dist-packages/odoo/addons/website/models/ir_http.py", line 198, in _dispatch
  response = super(Http, cls)._dispatch()
File: "/usr/lib/python3/dist-packages/odoo/addons/auth_signup/models/ir_http.py", line 19, in _dispatch
  return super(Http, cls)._dispatch()
File: "/usr/lib/python3/dist-packages/odoo/addons/web_editor/models/ir_http.py", line 21, in _dispatch
  return super(IrHttp, cls)._dispatch()
File: "/usr/lib/python3/dist-packages/odoo/addons/utm/models/ir_http.py", line 29, in _dispatch
  response = super(IrHttp, cls)._dispatch()
File: "/usr/lib/python3/dist-packages/odoo/addons/http_routing/models/ir_http.py", line 519, in _dispatch
  result = super(IrHttp, cls)._dispatch()
File: "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
  result = request.dispatch()
File: "/usr/lib/python3/dist-packages/odoo/http.py", line 687, in dispatch
  result = self._call_function(**self.params)
File: "/usr/lib/python3/dist-packages/odoo/http.py", line 359, in _call_function
  return checked_call(self.db, *args, **kwargs)
File: "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper
  return f(dbname, *args, **kwargs)
File: "/usr/lib/python3/dist-packages/odoo/http.py", line 348, in checked_call
  result = self.endpoint(*a, **kw)
File: "/usr/lib/python3/dist-packages/odoo/http.py", line 916, in __call__
  return self.method(*args, **kw)
File: "/usr/lib/python3/dist-packages/odoo/http.py", line 535, in response_wrap
  response = f(*args, **kw)
File: "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1343, in call_kw
  return self._call_kw(model, method, args, kwargs)
File: "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1335, in _call_kw
  return call_kw(request.env[model], method, args, kwargs)
File: "/usr/lib/python3/dist-packages/odoo/api.py", line 464, in call_kw
  result = _call_kw_multi(method, model, args, kwargs)
File: "/usr/lib/python3/dist-packages/odoo/api.py", line 451, in _call_kw_multi
  result = method(recs, *args, **kwargs)
File: "/usr/lib/python3/dist-packages/odoo/models.py", line 6475, in onchange
  record._onchange_eval(name, field_onchange[name], result)
File: "/usr/lib/python3/dist-packages/odoo/models.py", line 6208, in _onchange_eval
  method_res = method(self)
File: "/usr/lib/python3/dist-packages/odoo/addons/mail/wizard/mail_compose_message.py", line 170, in _onchange_template_id_wrapper
  values = self._onchange_template_id(self.template_id.id, self.composition_mode, self.model, self.res_id)['value']
File: "/usr/lib/python3/dist-packages/odoo/addons/mail/wizard/mail_compose_message.py", line 552, in _onchange_template_id
  values = self.generate_email_for_composer(
File: "/usr/lib/python3/dist-packages/odoo/addons/mail/wizard/mail_compose_message.py", line 663, in generate_email_for_composer
  template_values = self.env['mail.template'].with_context(tpl_partners_only=True).browse(template_id).generate_email(res_ids, fields)
File: "/usr/lib/python3/dist-packages/odoo/addons/account_edi/models/mail_template.py", line 21, in generate_email
  res = super().generate_email(res_ids, fields)
File: "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_template.py", line 236, in generate_email
  result, format = report._render_qweb_pdf([res_id])
File: "/usr/lib/python3/dist-packages/odoo/addons/account/models/ir_actions_report.py", line 49, in _render_qweb_pdf
  return super()._render_qweb_pdf(res_ids=res_ids, data=data)
File: "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 904, in _render_qweb_pdf
  pdf_content = self._run_wkhtmltopdf(
File: "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 486, in _run_wkhtmltopdf
  out, err = process.communicate()
File: "/usr/lib/python3.9/subprocess.py", line 1134, in communicate
  stdout, stderr = self._communicate(input, endtime, timeout)
File: "/usr/lib/python3.9/subprocess.py", line 1981, in _communicate
  ready = selector.select(timeout)
File: "/usr/lib/python3.9/selectors.py", line 416, in select
  fd_event_list = self._selector.poll(timeout)
hoangtrann commented 2 years ago

Could you check and verify if, accessing to the server/backend and invoking wkhtmltopdf works fine?

iangozer commented 2 years ago

Thanks for getting back to me on this, I gave up in the end. I don't quite understand how Odoo uses the different connections so decided it was probably best to avoid docker and Traefik until I can get a grip on that. I had assumed as long as the container can see the DB and users can see the odoo app then it should all work but seems like there was maybe some other localhost access needed.