No such file or directory errors, nginx hang after a few hours

Hi,

I am pretty new to nginx so I am pretty sure I must do something wrong
here.

Basically, I am using nginx as a proxy cache but nginx only read in a
given directory, if the file is not found, nginx proxy pass to the app
which return the file and write to the directory so next time Nginx can
get it directly.

The issue is that when the file is not in the directory yet, nginx
throws an error like that:

2009/12/06 06:16:15 16804#0: *19879 open()
“/opt/datastore/68/alt:strip-details.jpg” failed (2: No such file or
directory)

And as you can guess, i got ton of them… So I disabled the error log,
well i put it to log crit level only. But I am pretty sure there is a
cleaner way to deal with this.

My nginx.conf is pretty simple. I have a few rewrite rules to convert an
uri to a given file path then I catch the 404 errors.

server {

  # Regular config stuff....

  #Render
  if ($args ~* (+)=(\d+).type=(.*).v=(\d+))
  {
     set $args $1/$2/$3;
     rewrite "/render/screenshot.jspa" /wow/render/$args.jpg;
   }

   location / {
         root   /opt/datastore;
         index  index.html index.htm;
         error_page 404 = /fallback;
    }

  location = /fallback {
                    # only internal requests can reach this endpoint
                   internal;

                    # proxy config
                    proxy_redirect off;
                    proxy_set_header   Host             $host;
                    proxy_set_header   X-Real-IP 

$remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;

                    # dispatch to haproxy
                    proxy_pass http://172.31.1.9;
            }

}

And somehow, after a few hours, nginx hang which might be tied with all
those failed open files error or not, I dont know at this point. I just
re enabled all errors to see if there is something unusual in the log
once it hangs.

I am using Nginx 0.8.24 on Opensolaris snv127

Thanks in advance for your help.
Chris

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,28335,28335#msg-28335

Hi , after i clean cache , i see critical warning in my log, its normal?

2013/03/05 12:41:42 [crit] 40771#0: unlink()
“/nginx/temp/proxy/3/9b/79fac0c8634496bb89b7d9d9dd3349b3” failed (2: No
such
file oectory)
2013/03/05 12:41:42 [crit] 40771#0: unlink()
“/nginx/temp/proxy/f/0c/f04ebf30ad0cea667ee5938fe09660cf” failed (2: No
such
file oectory)
2013/03/05 12:41:42 [crit] 40771#0: unlink()
“/nginx/temp/proxy/a/0e/2dd596f873e4901c7856634eff8470ea” failed (2: No
such
file oectory)
2013/03/05 12:41:42 [crit] 40771#0: unlink()
“/nginx/temp/proxy/1/6b/16e2a000c02197d069b9d50170ec56b1” failed (2: No
such
file oectory)

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,28335,236946#msg-236946

I clear only files, don’t remove dir, my script example

#!/bin/bash

CACHE_DIR=’/nginx/temp/proxy’
for i in find ${CACHE_DIR} -type f; do rm $i ; done

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,28335,236947#msg-236947

Hello!

On Tue, Mar 05, 2013 at 05:48:03AM -0500, arty777 wrote:

file oectory)
2013/03/05 12:41:42 [crit] 40771#0: unlink()
“/nginx/temp/proxy/1/6b/16e2a000c02197d069b9d50170ec56b1” failed (2: No such
file oectory)

Yes, it’s normal - as long as you removed the files in question
yourself.


Maxim D.
http://nginx.org/en/donation.html

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs