[nginx] Core: added prefix-based temporary files.

Piotr Sikora piotr at cloudflare.com
Tue Jan 6 02:11:16 UTC 2015


Hey Valentin,

> details:   http://hg.nginx.org/nginx/rev/a9138c35120d
> branches:
> changeset: 5958:a9138c35120d
> user:      Valentin Bartenev <vbart at nginx.com>
> date:      Fri Dec 26 16:22:54 2014 +0300
> description:
> Core: added prefix-based temporary files.
>
> Now, if the "path" parameter is NULL, ngx_create_temp_file() will use
> file->name as a predefined file path prefix.

This breaks terribly when "levels" parameter is also used, i.e.:

    proxy_cache_path /tmp/cache keys_zone=x:1m levels=2 use_temp_path=off;

Such configuration results in:

   [debug] 23696#0: *1 hashed path:
/tmp/cache/97/a81259cef8e959c624df1d456e5d3297.0000000001
   [debug] 23696#0: *1 temp fd:-1
   [crit] 23696#0: *1 open()
"/tmp/cache/97/a81259cef8e959c624df1d456e5d3297.0000000001" failed (2:
No such file or directory) while reading upstream, client: 127.0.0.1,
server: , request: "GET /valid1 HTTP/1.1", upstream:
"http://127.0.0.1:7071/", host: "localhost:8081"
   [debug] 23696#0: *1 finalize http upstream request: -1

because "/tmp/cache/97/" doesn't exist and nginx never tries to create
it in the prefix-based version.

Best regards,
Piotr Sikora



More information about the nginx-devel mailing list