# File is not refreshed when using proxy\_cache\_use\_stale

**URL:** <https://www.ruby-forum.com/t/file-is-not-refreshed-when-using-proxy-cache-use-stale/216670>\
**Category:** NGINX\
**Created:** [February 10, 2012, 11:06am UTC](https://www.ruby-forum.com/t/file-is-not-refreshed-when-using-proxy-cache-use-stale/216670 "2012-02-10T11:06:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [February 10, 2012, 11:06am UTC](https://www.ruby-forum.com/t/file-is-not-refreshed-when-using-proxy-cache-use-stale/216670/1 "2012-02-10T11:06:29Z")

</div>

I have following config:

location /images {  
proxy\_pass [http://my.host](http://my.host);  
proxy\_redirect off;  
proxy\_cache static-cache;  
proxy\_cache\_valid any 5m;  
proxy\_cache\_valid 404 5m;  
proxy\_cache\_use\_stale updating invalid\_header error timeout http\_502;  
}

The idea is that if backend server reply with error/timeout/invalid  
header it will return stale version and cache it for 5m. Generally it  
works ok but sometimes I have situation when one of my proxy cache  
servers (I have 3 of them) returns stale version and will not refresh  
file until I delete nginx cache files. Here is output from nginx -V:

$ nginx -V  
nginx version: nginx/0.7.65  
TLS SNI support enabled  
configure arguments: --conf-path=/etc/nginx/nginx.conf  
–error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid  
–lock-path=/var/lock/nginx.lock  
–http-log-path=/var/log/nginx/access.log  
–http-client-body-temp-path=/var/lib/nginx/body  
–http-proxy-temp-path=/var/lib/nginx/proxy  
–http-fastcgi-temp-path=/var/lib/nginx/fastcgi --with-debug  
–with-http\_stub\_status\_module --with-http\_flv\_module  
–with-http\_ssl\_module --with-http\_dav\_module  
–with-http\_gzip\_static\_module --with-http\_realip\_module --with-mail  
–with-mail\_ssl\_module --with-ipv6  
–add-module=/build/buildd/nginx-0.7.65/modules/nginx-upstream-fair

Is it known problem or I am doing something wrong?

Posted at Nginx Forum:

> **[File is not refreshed when using proxy\_cache\_use\_stale](https://forum.nginx.org/read.php?2,222215,222215#msg-222215)**
>
> I have following config: location /images { proxy\_pass http://my.host; proxy\_redirect off; proxy\_cache static-cache; proxy\_cache\_valid any 5m; proxy\_cache\_valid 404 5m; proxy\_cache\_use\_stale updating invalid\_header error timeout ht

---

<div class="post-metadata">

**Author:** ![radarek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c67d28/32.png) [@radarek](https://www.ruby-forum.com/u/radarek)\
**Post date:** [February 10, 2012, 2:46pm UTC](https://www.ruby-forum.com/t/file-is-not-refreshed-when-using-proxy-cache-use-stale/216670/2 "2012-02-10T14:46:16Z")

</div>

Hello!

On Fri, Feb 10, 2012 at 05:05:45AM -0500, radarek wrote:

> –error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid
> 
> Is it known problem or I am doing something wrong?

The above may happen if nginx worker process dies, leaving cache  
node marked as being updated. Try looking into your logs to see  
if this is the case. That is: if you have alerts about “worker  
process exited on signal …” - you have a problem, and this is  
expected result.

In any case it’s good idea to upgrade from long unsupported 0.7.x  
branch to at least stable 1.0.x.

Maxim D.

---

<div class="post-metadata">

**Author:** ![radarek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c67d28/32.png) [@radarek](https://www.ruby-forum.com/u/radarek)\
**Post date:** [February 10, 2012, 3:46pm UTC](https://www.ruby-forum.com/t/file-is-not-refreshed-when-using-proxy-cache-use-stale/216670/3 "2012-02-10T15:46:06Z")

</div>

## Maxim D. Wrote:

> expected result.  
> I looked in the error log and found exactly what you suggested:  
> 2011/08/09 08:50:15 [alert] 25485#0: cache loader process 25488 exited  
> on signal 9  
> 2011/10/16 17:16:36 [alert] 25509#0: worker process 25510 exited on  
> signal 6  
> 2012/01/16 12:48:13 [alert] 9183#0: worker process 9184 exited on signal  
> 6  
> 2012/01/16 14:19:24 [alert] 9183#0: worker process 11897 exited on  
> signal 6

Shouldn’t it be treated as a bug? Do you know what thing could caused  
sending signal 6 to worker process?

> In any case it’s good idea to upgrade from long  
> unsupported 0.7.x  
> branch to at least stable 1.0.x.

Yeah, I will probably do it in near future.

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,222215,222234#msg-222234](http://forum.nginx.org/read.php?2,222215,222234#msg-222234)

---

<div class="post-metadata">

**Author:** ![radarek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c67d28/32.png) [@radarek](https://www.ruby-forum.com/u/radarek)\
**Post date:** [February 10, 2012, 4:34pm UTC](https://www.ruby-forum.com/t/file-is-not-refreshed-when-using-proxy-cache-use-stale/216670/4 "2012-02-10T16:34:38Z")

</div>

Hello!

On Fri, Feb 10, 2012 at 09:45:40AM -0500, radarek wrote:

> > process exited on signal …" - you have a  
> > 2012/01/16 14:19:24 [alert] 9183#0: worker process 11897 exited on  
> > signal 6
> 
> Shouldn’t it be treated as a bug? Do you know what thing could caused  
> sending signal 6 to worker process?

There are lots of bugs fixed since 0.7.65 which may cause this.  
Signal 6 is likely generated by libc due to detected memory  
corruption.

> > In any case it’s good idea to upgrade from long  
> > unsupported 0.7.x  
> > branch to at least stable 1.0.x.
> 
> Yeah, I will probably do it in near future.

Yes, please.

Maxim D.
