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_size 1m; > 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