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

Tlvenn nginx-forum at nginx.us
Sun Dec 6 08:44:08 MSK 2009


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




More information about the nginx mailing list