Nginx temp file being deleted errenously

Gregory Edigarov edigarov at
Wed Jan 30 13:25:00 UTC 2013

On 01/26/2013 02:36 AM, tulumvinh at wrote:
> Hello everyone,
> My company processes millions of requests for file uploads/downloads and we
> are looking at Nginx to replace Apache.  We are running into a problem that
> I hope you can help -- I have searched the web and even read Nginx HTTP
> Server book by Clement Nedelcu.
> At a high level, the flow of a request through our system is as follows:
> user agent  posts the data to upload  -->  Ngixn acting as a reverse proxy
> -->  Object store ->  post action of passing request to Uwsgi.
> Problem:   when uploading a large file (~ 100MB) , the post action is
> failing.  The error message seen in error.log is  "8 sendfile() failed (9:
> Bad file descriptor) while sending request to upstream," message.  This use
> case occurs even if no load on the system,
> When I enable "debug", I see that after the Nginx streams the bytes to the
> object store, the temp file is deleted.  When the post action is executed it
> fails as the temp file is gone.
> *Note:  this error is NOT seen when upload small files.

I would store the file in some temporary space on frontend, and then forwarded it to the storage backend.
With best regards,
      Gregory Edigarov

More information about the nginx mailing list