Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

incompatibility with open_file_cache option #3

Open
funny-falcon opened this Issue · 1 comment

2 participants

Sokolov Yura jaqq2
Sokolov Yura

Config:

# run with nginx -p . -c nginx.conf
daemon off;
worker_processes 1;
pid nginx.pid;

events {
  use epoll;
  worker_connections 2000;
}

error_log stderr;

http {
    slowfs_cache_path tmpfs/cache levels=1:2 keys_zone=memcache:100m inactive=1h max_size=100M;
    slowfs_temp_path tmpfs/tmp 1 2;

    access_log /dev/stdout;
    open_file_cache max=100;

    server {
        listen 8010;
        location / {
        root /path/to/files;
        slowfs_cache memcache;
        slowfs_cache_key $uri;
        slowfs_cache_valid 1m;
        slowfs_cache_min_uses 1;
        slowfs_big_file_size 128k;
   }
}

two files in /path/to/files:

$ ls -l
-rw-rw-r-- 1 yura yura 96432450 окт.  12 12:22 aaaa1.txt
-rw-rw-r-- 1 yura yura 96432450 окт.  12 11:54 aaaa.txt

request first file, then second, wait till cache file for first file disappeared and request first file again

$ curl 'http://localhost:8010/aaaa.txt' > /dev/null
$ curl 'http://localhost:8010/aaaa1.txt' > /dev/null
$ # wait here till cache for aaaa.txt disappeared
$ curl 'http://localhost:8010/aaaa.txt' > /dev/null

nginx put in his log (in stdout with this config):

127.0.0.1 - - [12/Oct/2012:15:37:00 +0400] "GET /aaaa.txt HTTP/1.1" 200 96432450 "-" "curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3"
127.0.0.1 - - [12/Oct/2012:15:37:05 +0400] "GET /aaaa1.txt HTTP/1.1" 200 96432450 "-" "curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3"
2012/10/12 15:37:09 [alert] 27573#0: *3 read() has read only 0 of 96432450 bytes (2: No such file or directory) while populating cache, client: 127.0.0.1, server: , request: "GET /aaaa.txt HTTP/1.1", host: "localhost:8010"
2012/10/12 15:37:09 [alert] 27573#0: *3 http file cache copy: "/path/to/files/aaaa.txt" failed (2: No such file or directory) while populating cache, client: 127.0.0.1, server: , request: "GET /aaaa.txt HTTP/1.1", host: "localhost:8010"
127.0.0.1 - - [12/Oct/2012:15:37:09 +0400] "GET /aaaa.txt HTTP/1.1" 200 96432450 "-" "curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3"
jaqq2

works fine for me using nginx 1.2.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.