Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0] Downloading of larger computed binary files gets truncated in worker mode #67221

Open
dhannyz opened this issue Mar 4, 2021 · 4 comments
Labels
14.0 Framework General frontend/backend framework issues

Comments

@dhannyz
Copy link

dhannyz commented Mar 4, 2021

Impacted versions:
14.0

Steps to reproduce:
Ubuntu 20.04 + Python3.8 + workers > 1

Current behavior:
With workers enabled the downloading of a 17 MB computed binary field is being truncated strangely at sizes varying from 11.9 to 14.6 MB. I have experimented with worker memory limits and cpu timeouts to no avail. These shouldn't be factors anyway as the computation completes quite quickly

Disabling workers and the download completes fully

Expected behavior:
The file downloads fully

@pedrobaeza
Copy link
Collaborator

@yajo this sounds a lot to me. Do you remember how do we fixed it?

@Yenthe666 Yenthe666 added 14.0 Framework General frontend/backend framework issues labels Mar 5, 2021
@yajo
Copy link
Contributor

yajo commented Mar 5, 2021

Increase the env variable ODOO_HTTP_SOCKET_TIMEOUT.

@aek
Copy link

aek commented Sep 6, 2022

@yajo what it's a good value for the ODOO_HTTP_SOCKET_TIMEOUT env variable?
I have been playing with 1800 to solve the dowload of some files that otherwise gets truncated, but now I have seen issues with reports in Odoo 12 because of this.
Here it's what shows wkhtmltopdf

Loading pages (1/6)
Error: Failed to load http://localhost:9003/web/content/158890-55adc32/web.report_assets_pdf.0.css, with network status code 4 and http status code 0 - Socket operation timed out
Error: Failed to load http://localhost:9003/web/content/161543-6c38704/web.report_assets_common.0.css, with network status code 4 and http status code 0 - Socket operation timed out
Error: Failed to load http://localhost:9003/web/content/161544-6c38704/web.report_assets_common.1.css, with network status code 4 and http status code 0 - Socket operation timed out
Counting pages (2/6)                                               
Resolving links (4/6)                                                       
Loading headers and footers (5/6)                                           
Error: Failed to load http://localhost:9003/web/content/158890-55adc32/web.report_assets_pdf.0.css, with network status code 4 and http status code 0 - Socket operation timed out
Error: Failed to load http://localhost:9003/web/content/161543-6c38704/web.report_assets_common.0.css, with network status code 4 and http status code 0 - Socket operation timed out
Error: Failed to load http://localhost:9003/web/content/161544-6c38704/web.report_assets_common.1.css, with network status code 4 and http status code 0 - Socket operation timed out
Printing pages (6/6)                                               
Done

Reverting back to default value 2 solve the issue with wkhtmltopdf
Using:
wkhtmltopdf 0.12.5 (with patched qt)

@yajo
Copy link
Contributor

yajo commented Sep 6, 2022

The best explanation you can find it in code:

odoo/odoo/service/server.py

Lines 1072 to 1078 in 0991993

# The ODOO_HTTP_SOCKET_TIMEOUT environment variable allows to control socket timeout for
# extreme latency situations. It's generally better to use a good buffering reverse proxy
# to quickly free workers rather than increasing this timeout to accommodate high network
# latencies & b/w saturation. This timeout is also essential to protect against accidental
# DoS due to idle HTTP connections.
sock_timeout = os.environ.get("ODOO_HTTP_SOCKET_TIMEOUT")
self.sock_timeout = float(sock_timeout) if sock_timeout else 2

The correct value depends on your environment.

Enable buffering in your reverse proxy for best results: #20158 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
14.0 Framework General frontend/backend framework issues
Projects
None yet
Development

No branches or pull requests

5 participants