Opened 3 years ago

Closed 2 years ago

#1249 closed defect (fixed)

Blocking STALE requests using proxy_cache_background_update on Docker

Reported by: rdngr@… Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.11.x
Keywords: Cc:
uname -a: Linux 4a7e76772df1 4.10.8-1-ARCH #1 SMP PREEMPT Fri Mar 31 16:50:19 CEST 2017 x86_64 Linux
nginx -V: nginx version: nginx/1.11.13 built by gcc 6.2.1 20160822 (Alpine 6.2.1) built with OpenSSL 1.0.2k 26 Jan 2017 TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/ --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_perl_module=dynamic --with-threads --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-stream_realip_module --with-stream_geoip_module=dynamic --with-http_slice_module --with-mail --with-mail_ssl_module --with-compat --with-file-aio --with-http_v2_module --with-debug


When running nginx within a Docker container operating in bridged networking mode the proxy_cache_background_update feature does not always work as intended. Certain requests, particularly requests with large response bodies, will cause nginx to wait for the server to reply with a new version instead of immediately sending the cached resource.

All requests where background updates become blocking log the following:

2017/04/14 08:13:46 [debug] 7#7: *3 writev() not ready (11: Resource temporarily unavailable)

Switching the Docker container to host networking mode seems to completely resolve the issue.

The issue has been replicated on three different machines (two physical running Arch Linux and one virtual running CentOS 7), with three different Docker versions: 1.12.6, 17.03.0, and 17.04.0.

The behavior is identical on both Ubuntu and Alpine base Docker images.

Scripts and configuration for reproducing the issue are available at

Attachments (1)

bgsub (6.2 KB) - added by arut 3 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 3 years ago by arut

This looks like a known issue.
Can you try the patch and report if it fixes the problem?

Changed 3 years ago by arut

comment:2 Changed 3 years ago by rdngr@…

The patch solved the issue perfectly. Thank you!

Will the patch be merged into the mainline branch in the near future?

comment:4 Changed 2 years ago by arut

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.