Iscu Andrei
Iscu Andrei

Reputation: 11

K8S ingress-nginx Client request body buffering to a temporary file

Been running into a strange warning with ingress-nginx on a K8S deployment. Basically, the error is 2023/02/16 15:56:03 [warn] 34#34: *7840048 a client request body is buffered to a temporary file /tmp/nginx/client-body/0000009342, client: <client ip>, server: <hostname>, request: "POST /next HTTP/2.0", host: "<hostname>", referrer: "<hostname>"

The deployment was made with helm, using default values; the helm chart version is ingress-nginx-4.3.0 and app version is 1.4.0 What's even more annoying is that I get this warning for requests having the body as small as 500 bytes.

The gist of it all is, I'm not sure if this warning causes the following scenario: the upstream gets the request, but the client gets no reply (not even a 4xx/5xx Error). Been going over logs like crazy, but there's nothing conclusive to figure out if I can safely ignore this warning.

Thanks!

Deployed Helm chart in a different K8S cluster, using all default values with same result. Increased the timeout on the upstream side to 60s.

Upvotes: 1

Views: 1591

Answers (1)

Fariya Rahmat
Fariya Rahmat

Reputation: 3220

This warning message means that the size of the uploaded file was larger than the in-memory buffer reserved for uploads.

Refer to document explaining how client_body_buffer_size works:

Sets buffer size for reading client request body. In case the request body is larger than the buffer, the whole body or only its part is written to a temporary file. By default, buffer size is equal to two memory pages. This is 8K on x86, other 32-bit platforms, and x86-64. It is usually 16K on other 64-bit platforms.

So, lower the value of the uploaded file according to client_body_buffer_size to remove that warning .This buffer is only used while a request body is being uploaded. Once the upload is complete the memory is free to be used for another request.

Upvotes: 0

Related Questions