jeanpommier commented on issue #28259:
URL: https://github.com/apache/superset/issues/28259#issuecomment-2834537288

   Hey there,
   I was too having the problem, it was really inconvenient. But I think I 
found the solution this week end: increasing the gunicorn keepalive setting to 
40 seconds gets rid of those errors.
   
   My Superset instance is integrated in a 
[geOrchestra](https://www.georchestra.org/) platform, behind a Spring cloud 
gateway doing routing & authentication. On a kubernetes infrastructure, so I 
also have an ingress reverse-proxy (traefik in my case).
   Looking at the gateway logs, I indeed had  `PrematureCloseException` or 
similar exceptions everytime a chunk load error happened. 
   Digging into this (thanks also to [a video about Netty server from 
violetagg](https://youtu.be/LLSln1_JAMY?t=1926)), I figured out that my issue 
was Superset/gunicorn closing connections while upstream reverse-proxies were 
still thinking them active.
   Setting the env var `GUNICORN_KEEPALIVE` to 40 (seconds) did the trick. 
Maybe we don't need to increase them that much, but the default, 2s, seems 
really too short (and is documented in 
https://docs.gunicorn.org/en/stable/settings.html#keepalive). 
   In any case, taking my situation as an example, as far as I understand it, 
we need to make sure that: gunicorn keepalive > gateway max-idle-time > traefik 
idleConnTimeout.
   
   I also have the impression that adjusting gunicorn workers and thread 
numbers improves a bit the latency, but that just a feeling.
   
   While playing with connection timeout and more specificly with Spring Cloud 
Gateway, it might be also interesting to consider changing the leasing-strategy 
to `lifo` (see [config 
reference](https://docs.spring.io/spring-cloud-gateway/reference/appendix.html))
 and possibly [disabling the response-timeout for the superset 
route](https://docs.spring.io/spring-cloud-gateway/reference/spring-cloud-gateway/http-timeouts-configuration.html#per-route-timeouts)
 to cover long-lasting queries.
   
   Hope this helps


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to