Re: sendfile() failed (9: Bad file descriptor) while sending request to upstream
Hey Maxim! Thank you very much for your suggestion. Unfortunately our "project" still uses 1.13.3 (as of today only 1.13.3 is available via stretch-backports), so the mirror module (>= 1.13.4) is not yet available for here. I hope I will find the time to eventually report back on your config suggestion this as soon as I have the option to run your configuration with "live conditions". I very much appreciate there is an official implementation for "replaying requests" now. Keep on rocking! Best Benny Posted at Nginx Forum: https://forum.nginx.org/read.php?21,118976,278743#msg-278743 ___ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru
Re: sendfile() failed (9: Bad file descriptor) while sending request to upstream
Hello! On Thu, Feb 22, 2018 at 08:12:25AM -0500, papajoe wrote: > Hey everybody, > > I experienced this issue using nginx version 1.10.x and 1.13.x > > > given a basic configuration like: > > upstream myupstream { > server internal01:80; > server internal02:80 backup; > } > > server { > listen 81 default_server; > listen [::]:81 default_server; > > server_name _; > > location / { > proxy_pass http://myupstream; > post_action @hot_standby; > } > > location @hot_standby { > proxy_pass http://internal02:80; > } > } > > > I receive the "sendfile() failed (9: Bad file descriptor) while sending > request to upstream" error when trying to POST data exceeding 16k body > size. The error does not occur for requests with less than 16k data. > As far as I can understand the code / documentation, 16k by default (for > 64bit systems) is the limit when nginx starts to use a tempfile instead of a > memory buffer. > http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_buffer_size > > This makes me believe that the problem only kicks in when nginx decides to > use a tempfile instead of an inmemory buffer. > > > For my setup I was able to fix the issue by an alignment between > client_body_buffer_size and client_max_body_size. > > client_max_body_size1m; > client_body_buffer_size 1m; > > > Hope this can help anybody. Just in case you are interested in details, this is a result in optimization in the proxy module, which removes the request body file as soon as a response is received. Additional details can be found here: http://hg.nginx.org/nginx/rev/f583559aadc7 https://trac.nginx.org/nginx/ticket/585 To fix this, consider using mirror instead of the [intentionally undocumented] post_action directive, see http://nginx.org/en/docs/http/ngx_http_mirror_module.html. -- Maxim Dounin http://mdounin.ru/ ___ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru
Re: sendfile() failed (9: Bad file descriptor) while sending request to upstream
Hey everybody, I experienced this issue using nginx version 1.10.x and 1.13.x given a basic configuration like: upstream myupstream { server internal01:80; server internal02:80 backup; } server { listen 81 default_server; listen [::]:81 default_server; server_name _; location / { proxy_pass http://myupstream; post_action @hot_standby; } location @hot_standby { proxy_pass http://internal02:80; } } I receive the "sendfile() failed (9: Bad file descriptor) while sending request to upstream" error when trying to POST data exceeding 16k body size. The error does not occur for requests with less than 16k data. As far as I can understand the code / documentation, 16k by default (for 64bit systems) is the limit when nginx starts to use a tempfile instead of a memory buffer. http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_buffer_size This makes me believe that the problem only kicks in when nginx decides to use a tempfile instead of an inmemory buffer. For my setup I was able to fix the issue by an alignment between client_body_buffer_size and client_max_body_size. client_max_body_size1m; client_body_buffer_size 1m; Hope this can help anybody. Best Benny Posted at Nginx Forum: https://forum.nginx.org/read.php?21,118976,278721#msg-278721 ___ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru