Resource temporarily unavailable with css file

Maxim Dounin mdounin at mdounin.ru
Thu Apr 14 15:00:59 MSD 2011


Hello!

On Thu, Apr 14, 2011 at 12:46:24AM -0400, jeff14 wrote:

> hi,  i used nginx 0.7.65 before, and i upgrade it to 1.0.0 yesterday,
> but after this update ,i  got some strange error.
> i have a normal html web page call myHtml.html, it linked a css file
> called myCss.css.
> 1. i open this web page, this is ok
> 2. i change some content of myCss.css.
> 3. i refresh myHtml.html, but i get 500 error of getting the css file:
> (/dat/web is my root directory)
> 2011/04/14 12:29:35 [crit] 23140#0: *124 open() "/dat/web/myCss.css"
> failed (11: Resource temporarily unavailable), client: 192.168.1.201,
> server: *.test.com, request: "GET /myCss.css HTTP/1.1", host:
> "my.test.com", referrer: "http://my.test.com/"
> 4. i press F5 to refresh this page again , then i got the normal html
> and css file, everything seems ok.
> 
> can everybody tell me what happen? thanks

Which OS?  Which filesystem?  Which editor?  From error returned 
to nginx it looks like your editor uses mandatory locking and 
that's why nginx can't open file.  Versions prior to 0.8.36/0.7.66 
will likely just hang in such situation waiting for file to be 
released.

Note also that it's not generally safe to edit files which are 
served at the same moment (this applies to all servers, not just 
nginx).  Consider the following scenario:

1. You have a file with "A"s inside.  User starts downloading a 
file.  Server opens it, and sends first half of the file.

2. You edit the file and change all "A"s to "B"s.

3. Server sends last half of the file.

4. Oops.  User ends up with totally incorrect data: with half of 
"A"s and half of "B"s inside.

Recommended aproach is to edit copy, and then replace served file 
with atomic operation (via rename() system call, or via mv utility 
which calls it).

Maxim Dounin



More information about the nginx mailing list