#1801 closed defect (invalid)
Stale cache is not updated after some time
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | nginx-core | Version: | 1.14.x |
Keywords: | Cc: | ||
uname -a: | Linux webc-g1 4.19.0-0.bpo.5-amd64 #1 SMP Debian 4.19.37-3~bpo9+1 (2019-05-18) x86_64 GNU/Linux | ||
nginx -V: |
nginx version: nginx/1.14.1
built with OpenSSL 1.1.0f 25 May 2017 (running with OpenSSL 1.1.1b 26 Feb 2019) TLS SNI support enabled configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-jqo7Nx/nginx-1.14.1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_flv_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_mp4_module --with-http_perl_module=dynamic --with-http_random_index_module --with-http_secure_link_module --with-http_sub_module --with-http_xslt_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --add-dynamic-module=/build/nginx-jqo7Nx/nginx-1.14.1/debian/modules/http-headers-more-filter --add-dynamic-module=/build/nginx-jqo7Nx/nginx-1.14.1/debian/modules/http-auth-pam --add-dynamic-module=/build/nginx-jqo7Nx/nginx-1.14.1/debian/modules/http-cache-purge --add-dynamic-module=/build/nginx-jqo7Nx/nginx-1.14.1/debian/modules/http-dav-ext --add-dynamic-module=/build/nginx-jqo7Nx/nginx-1.14.1/debian/modules/http-ndk --add-dynamic-module=/build/nginx-jqo7Nx/nginx-1.14.1/debian/modules/http-echo --add-dynamic-module=/build/nginx-jqo7Nx/nginx-1.14.1/debian/modules/http-fancyindex --add-dynamic-module=/build/nginx-jqo7Nx/nginx-1.14.1/debian/modules/nchan --add-dynamic-module=/build/nginx-jqo7Nx/nginx-1.14.1/debian/modules/http-lua --add-dynamic-module=/build/nginx-jqo7Nx/nginx-1.14.1/debian/modules/rtmp --add-dynamic-module=/build/nginx-jqo7Nx/nginx-1.14.1/debian/modules/http-uploadprogress --add-dynamic-module=/build/nginx-jqo7Nx/nginx-1.14.1/debian/modules/http-upstream-fair --add-dynamic-module=/build/nginx-jqo7Nx/nginx-1.14.1/debian/modules/http-subs-filter |
Description
I configured a reverse caching proxy which makes use of "proxy_cache_use_stale updating" and "proxy_cache_background_update on".
At first everything seems to work fine, after some time (the day after) i notice that stale caches are not updated.
This is what happens until it works fine:
- Client makes the 1. request.
- Proxy responds with an updated response from the upstream server and "x-cache-status: MISS".
- Client makes the 2. request.
- Proxy responds with a cached response and "x-cache-status: HIT".
- Client waits 10 min. for the cache to expire and makes the 3. request.
- Proxy responds with a cached (and slightly outdated) response and "x-cache-status: STALE".
- Proxy is making a request to the upstream server.
- Client makes the 4. request.
- Proxy responds with a cached (and up to date) response and "x-cache-status: HIT".
After some time, apparently without any changes to the system, the cache breaks:
- Client makes the 1. request.
- Proxy responds with a cached (and outdated) response and "x-cache-status: STALE".
- Proxy is making a request to the upstream server.
- Client makes the 2. request.
- Proxy responds with a cached (and outdated) response and "x-cache-status: STALE".
- Proxy is making a request to the upstream server.
- Repeats forever.
At the moment I can not tell exactly how much time it needs to pass for the cache to break. Up to now i noticed a broken cache on the day after. Also I do not know if there is a correlation with the number and time of the requests being made in the meantime.
I attached the nginx configuration and two debug logs of the cache updating fine and not updating.
ps: the upstream server add "x-accel-expire: 600" to the response.
Attachments (4)
Change History (8)
by , 5 years ago
Attachment: | nginx_config added |
---|
comment:1 by , 5 years ago
Please close this ticket. It is not a bug, just my misunderstanding of how things work.
I'm sorry.
comment:3 by , 18 months ago
I'm having the same issue. Patrick, could you, please, clarify why this does not work as expected?
comment:4 by , 18 months ago
I guess that not all headers from backend were added to proxy_ignore_headers and thus nginx basically avoided caching. But what makes me wonder, why this happens with time, not immediately?
main configuration